forked from tsrot/react-zhihu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
42 lines (34 loc) · 883 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
38
39
40
41
42
var gulp = require('gulp'),
connect = require('gulp-connect'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
port = process.env.port || 5000 ;
gulp.task('browserify',function(){
gulp.src('./app/js/main.js')
.pipe(browserify({
transform:'reactify',
}))
.pipe(gulp.dest('./dist/js'))
});
gulp.task('connect',function(){
connect.server({
root:'./',
port:port,
livereload:true,
})
});
gulp.task('js',function(){
gulp.src('./dist/**/*.js')
.pipe(connect.reload())
});
gulp.task('html',function(){
gulp.src('./app/**/*.html')
.pipe(connect.reload())
});
gulp.task('watch',function(){
gulp.watch('./dist/**/*.js',['js']);
gulp.watch('./app/**/*.html',['html']);
gulp.watch('./app/**/*.js',['browserify']);
});
gulp.task('default',['browserify']);
gulp.task('server',['browserify','connect','watch']);