-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.ts
49 lines (42 loc) · 1.92 KB
/
gulpfile.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// these typed definition files are not available that is why we comment out this code for a time , and just define these files by using javascript code rather then typescript code , then we will write these tsds later... :)
/*
///<refrence path="./typings/gulp-rimraf/gulp-rimraf.d.ts"/>
/// <reference path="./typings/gulp/gulp.d.ts" />
/// <reference path="./typings/gulp-typescript/gulp-typescript.d.ts" />
/// <reference path="./typings/gulp-nodemon/gulp-nodemon.d.ts"/>
import gulp = require('gulp');
import ts = require('gulp-typescript');
import rimraf = require('gulp-rimraf');
import nodemon = require('gulp-nodemon'); */
let gulp = require('gulp');
let sass = require('gulp-sass');
let ts = require('gulp-typescript');
let rimraf = require('gulp-rimraf');
let nodemon = require('gulp-nodemon');
gulp.task('clearFrontendDir', function(){
return gulp.src('build_For_Frontend').pipe(rimraf());
});
gulp.task('buildfrontEndstyles',['clearFrontendDir'] , function() {
return gulp.src('src/**/*.scss')
.pipe(sass().on('error', sass.logError)).pipe(gulp.dest('build_For_Frontend/'));
});
gulp.task('clearBackendDir',['clearFrontendDir' ,'buildfrontEndstyles'] , function(){
return gulp.src('build_For_Backend').pipe(rimraf());
});
gulp.task('buildBackEnd' ,['clearFrontendDir' , 'buildfrontEndstyles' , 'clearBackendDir'] , function () {
var tsResult = gulp.src('src/**/*.ts')
.pipe(ts({module: 'CommonJS'}));
return tsResult.js.pipe(gulp.dest('build_For_Backend'));
});
gulp.task('nodemon', ['buildBackEnd','buildfrontEndstyles','watch'], function(){
nodemon({
script: 'build_For_Backend/backend/server.js'
}).on('restart', function(){
console.log('nodemon restarted server.js');
})
});
gulp.task('watch', function() {
gulp.watch('src/**/*.ts', ['buildBackEnd']);
gulp.watch('src/**/*.scss', ['buildfrontEndstyles']);
});
gulp.task('default', ['buildBackEnd','buildfrontEndstyles']);