-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·48 lines (43 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
47
48
var gulp = require('gulp'),
source = require('vinyl-source-stream'),
browserify = require('browserify'),
connect = require('gulp-connect-multi')(),
reactify = require('reactify'),
watchify = require('watchify'),
watch = require('gulp-watch');
gulp.task('build', function(){
var br = browserify({
entries: ['./src/js/detail.js'],
transform: [reactify],
debug: true,
cache: {},
packageCache: {},
fullPaths: true
});
br = watchify(br);
br.on('update', function(){
console.log('update');
build(br);
});
build(br);
});
gulp.task('connect', connect.server({
root: ['build'],
port: 9003,
livereload: true,
open:{
browser: 'Google Chrome' //'chrome'
}
}));
gulp.task('default', ['build', 'connect'], function(){
watch('./build/css/*.css', function(){
console.log('css updates...');
}).pipe(connect.reload());
});
function build(br){
console.log('build');
br.bundle()
.pipe(source('detail.js'))
.pipe(gulp.dest('./build/js'))
.pipe(connect.reload());
}