-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
43 lines (38 loc) · 1011 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
'use strict';
var gulp = require('gulp');
var minifyJs = require('gulp-minify');
var del = require('del');
var runSequence = require('gulp4-run-sequence');
var replace = require('gulp-string-replace');
var pjson = require('./package.json');
var sizereport = require('gulp-sizereport');
gulp.task('clean', function () {
return del(['dist']);
});
gulp.task('build-js', function () {
return gulp.src('./src/*.js')
.pipe(minifyJs({
noSource: true,
ext: {
min: '.min.js'
},
preserveComments: 'some',
exclude: ['tasks']
}))
.pipe(replace(new RegExp('@version@', 'g'), pjson.version))
.pipe(gulp.dest('dist'));
});
gulp.task('sizereport', function () {
return gulp.src('./dist/*')
.pipe(sizereport({
gzip: true
}));
});
gulp.task('build', function (callback) {
runSequence(
'clean',
'build-js',
'sizereport',
callback
);
});