-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (42 loc) · 1.03 KB
/
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
38
39
40
41
42
43
44
45
46
var gulp = require("gulp")
var browserify = require("browserify")
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gutil = require('gulp-util');
var uglify = require('gulp-uglify');
var babelify = require("babelify")
gulp.task("build", function() {
var b = browserify({
entries: './src/index.js',
debug: true,
transform: ['babelify']
})
return b.bundle()
.pipe(source('build.js'))
.pipe(buffer())
.on('error', gutil.log)
.pipe(gulp.dest('./public'));
})
gulp.task('product', function() {
var b = browserify({
entries: './src/index.js',
transform: ['babelify']
})
return b.bundle()
.pipe(source('build.js'))
.pipe(buffer())
.pipe(uglify())
.on('error', gutil.log)
.pipe(gulp.dest('./public/'));
})
gulp.task("watch", function() {
gulp.watch('src/*.js', ['build'])
gulp.watch('src/Components/*.js', ['build'])
})
gulp.task("default", function() {
if(!!gutil.env.production){
gulp.start('product')
}else{
gulp.start('build', 'watch')
}
})