-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
43 lines (36 loc) · 892 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
43
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'))
});
// live reload
gulp.task('connect',function(){
connect.server({
// root:'./',
port: port,
livereload: true,
})
})
// reload Js
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/**/*.js',['browserify']);
})
gulp.task('default',['browserify']);
gulp.task('serve',['browserify','connect','watch']);