-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
31 lines (31 loc) · 864 Bytes
/
gulpfile.js
File metadata and controls
31 lines (31 loc) · 864 Bytes
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
const sourcemaps = require('gulp-sourcemaps');
const gulp=require('gulp');
const exec = require('child_process').exec;
const uglify=require('gulp-uglify');
const rename = require('gulp-rename');
gulp.task('compress', function() {
return gulp.src('./src/loader.js')
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(rename({suffix:'.min'}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist'));
});
gulp.task('server-start',function(){
exec('node static_server.js',function(err,stdout,stderr){
if (err) {
console.error(err);
return;
}
});
});
gulp.task('open-browser',function(){
exec('start http://127.0.0.1:3000/test.html',function(err,stdout,stderr){
if (err) {
console.error(err);
return;
}
});
});
gulp.task('default',['compress','server-start','open-browser']);
gulp.watch('./src/*.js', ['compress']);