-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
43 lines (42 loc) · 1.93 KB
/
gulpfile.js
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
// 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'); */
var gulp = require('gulp');
var sass = require('gulp-sass');
var ts = require('gulp-typescript');
var rimraf = require('gulp-rimraf');
var 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']);