-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
37 lines (32 loc) · 984 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
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('gulp-browserify');
var uglify = require('gulp-uglify');
var gulpif = require('gulp-if');
var watch = require('gulp-watch');
var count = require('gulp-count');
gutil.log('Environment', gutil.colors.blue(gulp.env.production ? 'Production' : 'Development'));
gulp.task('scripts', function() {
return gulp.src('./js/app.js', {read: false})
.pipe(browserify({
insertGlobals : false,
transform: ['reactify'],
extensions: ['.jsx'],
debug: !gulp.env.production
}))
.pipe(gulpif(gulp.env.production, uglify({
mangle: {
except: ['require', 'export', '$super']
}
})))
.pipe(gulp.dest('./dist'));
});
gulp.task('watch', function() {
gulp.env.watch = true;
// Watch files and run tasks if they change
gulp.watch('js/**', function() {
gulp.run('scripts', function() {});
});
});
gulp.task('default', ['scripts', 'watch']);