forked from claviska/jquery-minicolors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
34 lines (29 loc) · 815 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
/* eslint-env node, es6 */
'use strict';
const gulp = require('gulp-help')(require('gulp'));
const del = require('del');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
// Clean
gulp.task('clean', 'Clean up!', () => {
return del('jquery.minicolors.min.js');
});
// Minify
gulp.task('minify', 'Minify it!', ['clean'], () => {
return gulp.src('jquery.minicolors.js')
.pipe(uglify({
preserveComments: 'license'
}))
.on('error', (err) => {
console.error(err);
this.emit('end');
})
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(__dirname));
});
// Watch for changes
gulp.task('watch', 'Watch for changes!', () => {
gulp.watch('jquery.minicolors.js', ['minify']);
});
// Default
gulp.task('default', 'The default task.', ['minify']);