-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
45 lines (40 loc) · 1.04 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
var fs = require('fs');
var gulp = require('gulp');
var gulpUtil = require('gulp-util');
var browserify = require('browserify');
var babelify = require('babelify');
var source = require('vinyl-source-stream');
var watchify = require('watchify');
var path = require('path');
var debug = require('gulp-debug');
debugger;
function getBundler() {
return (
browserify({
entries: 'Assets/Components/index.jsx',
extensions: ['.jsx'],
debug : true })
.transform(babelify));
}
function update(bundler) {
bundler
.bundle()
.on('error', gulpUtil.log)
.on('end', function() {
return gulpUtil.log('Bundle complete');
})
.pipe(source('bundle.js'))
.pipe(debug({title: 'unicorn:'}))
.pipe(gulp.dest('Assets/build'));
}
gulp.task('browserify', function() {
return update(getBundler());
});
gulp.task('watch', function(){
var watch = watchify(getBundler());
watch.on('update', function(){
return update(watch);
});
return update(watch);
});
gulp.task('default', ['browserify', 'watch'])