-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
45 lines (31 loc) · 1015 Bytes
/
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
var gulp = require( "gulp" );
var watch = require( 'gulp-watch' );
var plumber = require ( "gulp-plumber" );
var runSequence = require('run-sequence').use(gulp);
var uglify = require('gulp-uglify');
var rename = require("gulp-rename");
var babel = require('gulp-babel');
gulp.task ( "build", function ( cb ) {
runSequence( "babel", "uglify", cb );
} );
gulp.task ( "babel", function ( ) {
return gulp.src("src/*.js")
.pipe( plumber() )
.pipe( babel() )
.pipe ( plumber.stop() )
.pipe( gulp.dest("dist") );
} );
gulp.task ( "uglify", function ( ) {
return gulp.src( "dist/*.js" )
.pipe( plumber() )
.pipe( uglify() )
.pipe(rename({
extname: '.min.js'
}))
.pipe ( plumber.stop() )
.pipe( gulp.dest( 'dist' ));
} );
gulp.task( 'watch', function() {
gulp.watch( "src/*.js", [ "build" ] );
});
gulp.task('default', [ "watch", "build" ] , function() {});