-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
45 lines (40 loc) · 1.09 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
var gulp = require('gulp');
var clean = require('gulp-clean');
var sourcemaps = require('gulp-sourcemaps');
var babel = require('gulp-babel');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
gulp.task(
'clean',
function () {
return gulp.src(['map', 'update.js', 'diffNode.js', 'merge.js', 'chain.js', '*.min.js'], {read: false})
.pipe(clean());
}
);
gulp.task(
'development',
['clean'],
function () {
process.env.NODE_ENV = 'development';
return gulp.src('src/*.js')
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('map'))
.pipe(gulp.dest('.'));
}
);
gulp.task(
'production',
['development'],
function () {
process.env.NODE_ENV = 'production';
return gulp.src('src/*.js')
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(sourcemaps.write('map'))
.pipe(gulp.dest('.'));
}
);
gulp.task('default', ['production']);