-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
49 lines (42 loc) · 1.17 KB
/
gulpfile.js
File metadata and controls
49 lines (42 loc) · 1.17 KB
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
46
47
48
49
var gulp = require('gulp');
var babel = require('gulp-babel');
var concat = require('gulp-concat');
var del = require('del');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var runSequence = require('run-sequence');
var plumber = require('gulp-plumber');
var util = require('gulp-util');
var src = 'src/PasswordGenJS';
var dest = 'build';
var myPlumber = function() {
return plumber({
errorHandler: function(error) {
util.log(util.colors.red('Unhandled error:\n'), error.toString());
return this.emit('end');
}
});
};
gulp.task('clean:js', function() {
return del(dest + "/js");
});
gulp.task('js', ['clean:js'], function() {
return gulp.src([
src + '/*.es6'
], {
base: '.'
}).pipe(babel())
.pipe(myPlumber())
.pipe(sourcemaps.init())
.pipe(concat('master.js'))
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(dest));
});
gulp.task('build', ['js']);
gulp.task('watch', function() {
return gulp.watch(src + '/**', ['js']);
});
gulp.task('default', function (cb) {
return runSequence('build', 'watch', cb);
});