-
-
Notifications
You must be signed in to change notification settings - Fork 311
/
gulpfile.js
36 lines (31 loc) · 810 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
/* eslint-env node, es6 */
'use strict';
const gulp = require('gulp');
const del = require('del');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
// Clean
gulp.task('clean', gulp.series(() => {
return del('jquery.minicolors.min.js');
}));
// Minify
gulp.task('minify', gulp.series('clean', () => {
return gulp.src('jquery.minicolors.js')
.pipe(uglify({
output: {
comments: require('uglify-save-license')
}
}))
.on('error', (err) => {
console.error(err);
this.emit('end');
})
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(__dirname));
}));
// Watch for changes
gulp.task('watch', gulp.series(() => {
gulp.watch('jquery.minicolors.js', ['minify']);
}));
// Default
gulp.task('default', gulp.series('minify'));