-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
28 lines (25 loc) · 850 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
var gulp = require('gulp');
var browserify = require('browserify');
var to5ify = require('6to5ify');
var util = require('gulp-util');
var buffer = require('vinyl-buffer');
var source = require('vinyl-source-stream');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('build:todo', function() {
browserify('./src/app.js', { debug: true })
.add(require.resolve('6to5/polyfill'))
.transform(to5ify)
.bundle()
.on('error', util.log.bind(util, 'Browserify Error'))
.pipe(source('todo.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify({ mangle: false }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./src'));
});
gulp.task('watch', function() {
gulp.watch(['./src/*.js', '!./src/todo.js'], ['build:todo']);
});
gulp.task('default', ['build:todo', 'watch']);