-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
38 lines (30 loc) · 928 Bytes
/
gulpfile.js
File metadata and controls
38 lines (30 loc) · 928 Bytes
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
var browserify = require('browserify'),
gulp = require('gulp'),
reactify = require('reactify'),
browserSync = require('browser-sync'),
source = require('vinyl-source-stream');
gulp.task('compile', function(){
var b = browserify();
b.transform(reactify);
b.add('./src/js/main.js');
return b.bundle()
.pipe(source('main.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('browser-sync', function(){
browserSync({
server: {
baseDir: './dist/'
}
})
});
gulp.task('copy', function(){
gulp.src('./index.html')
.pipe(gulp.dest('dist'))
});
// use default task to launch BrowserSync and watch JS files
gulp.task('default', ['browser-sync', 'copy'], function () {
// add browserSync.reload to the tasks array to make
// all browsers reload after tasks are complete.
gulp.watch(["./src/js/**/*.js", "./src/views/**/*.jsx", "index.html", "app.css"], ['copy', 'compile', browserSync.reload]);
});