-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·61 lines (48 loc) · 1.48 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
'use strict';
var gulp = require('gulp');
var nodemon = require('gulp-nodemon')
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var obfuscate = require('gulp-obfuscate');
var sourcemaps = require('gulp-sourcemaps');
var babel = require('gulp-babel');
var stripDebug = require('gulp-strip-debug');
var assetsDir = './js-src/*.js';
var publicDir = './public/js/';
gulp.task('compile', () => {
return gulp.src(assetsDir)
.pipe(sourcemaps.init({identityMap:true, debug:true }))
//.pipe(obfuscate())
.pipe(babel({
presets: ['babel-preset-env']
}))
.pipe(stripDebug())
//.pipe(uglify())
.pipe(sourcemaps.write('maps',{includeContent: false, sourceRoot: '/usr/src/app/js-src/'}))
.pipe(gulp.dest(publicDir))
});
gulp.task('watch', () => {
return gulp.watch(assetsDir, ['compile']);
});
gulp.task('start-dev',['watch'], function(){
return nodemon({
"verbose": true,
ignore : ['public/js/*','js-src/*']
})
//have nodemon run watch on start
.on('restart', function(){
console.log(' ----------- Server restarted ------------ ');
})
.on('start', ['compile']);
});
gulp.task('start-live',['watch'], function(){
return nodemon({
"verbose": true,
ignore : ['public/js/*','js-src/*']
})
//have nodemon run watch on start
.on('restart', function(){
console.log(' ----------- Server restarted ------------ ');
})
.on('start', ['compile']);
});