forked from chenhuiYj/ec-do
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
35 lines (35 loc) · 883 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
'use strict';
let gulp = require('gulp');
let babel = require('gulp-babel');
// 获取 uglify 模块(用于压缩 JS)
let uglify = require('gulp-uglify');
/**
* 编译js文件
*/
gulp.task('es6-js', function () {
//pages下面的业务代码进行babel处理
gulp.src(['./src/ec-do-2.0.0.js','./test-es6.js'])
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('./dist'));
});
/**
* 压缩js
*/
gulp.task('minify-js',()=>{
return gulp.src(['./src/ec-do-1.1.4.js','./dist/ec-do-2.0.0.js'])
.pipe(uglify({
compress:false,
mangle:{
reserved:['$super', '$', 'exports', 'require', 'define', 'module']
}
}))
.pipe(gulp.dest('./src/min'));
});
/**
* 运行任务
*/
gulp.task('default', ['es6-js'], function () {
gulp.watch('*.js', ['es6-js']);
});;