-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
38 lines (27 loc) · 881 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
var gulp = require('gulp');
var browserify = require('browserify');
var reactify = require('reactify');
var source = require('vinyl-source-stream');
var SRC_DIR = './assets';
var DEST_DIR = './static';
gulp.task('browserify', function(){
return browserify(SRC_DIR + '/js/main.js',{debug:true})
.transform('reactify')
.bundle()
.on('error',function(err){
console.log('error',err.stack);
console.log('-- THERE IS AN ERROR SEE ABOVE --');
this.emit('end');
})
.pipe(source('main.js'))
.pipe(gulp.dest(DEST_DIR + '/js'));
});
gulp.task('copy', function(){
return gulp.src([SRC_DIR + '/**/*.*','!' + SRC_DIR + '/js/**/*.*'])
.pipe(gulp.dest(DEST_DIR));
});
gulp.task('build',['browserify', 'copy']);
gulp.task('watch',function(){
return gulp.watch(SRC_DIR + '/**/*.*', ['build']);
});
gulp.task('default',['build','watch']);