-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
35 lines (31 loc) · 956 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
/**
* Created by yuancheng.yuan on 2017/9/6.
*/
var gulp = require('gulp');
var uglifyjs = require('uglify-js'); // can be a git checkout
var rename = require('gulp-rename');
var composer = require('gulp-uglify/composer');
var pump = require('pump');
const babel = require('gulp-babel');
var minify = composer(uglifyjs, console);
// 编译并压缩js
gulp.task('convertJS', function () {
return gulp.src('src/index.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('dist'))
})
gulp.task('compress', function () {
// the same options as described above
return gulp.src('dist/index.js')
.pipe(rename(function (path) {
path.basename = "railFenceCipher.min";
path.extname = ".js"
}))
.pipe(minify())
.pipe(gulp.dest('dist'))
});
gulp.task('default', ['convertJS', 'compress'], function () {
// 将你的默认的任务代码放在这
});