-
Notifications
You must be signed in to change notification settings - Fork 114
/
gulpfile.js
48 lines (41 loc) · 1.06 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');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var browserSync = require('browser-sync').create();
var watch = function() {
browserSync.init({
server: './public'
});
gulp.watch('app/**/*', ['build']);
gulp.watch('public/*').on('change', browserSync.reload);
};
var build = function () {
// set up the browserify instance on a task basis
var b = browserify('./app/initialize.js', {
transform: [
['babelify', {
'presets': ['es2015']
}],
['jstify']
]
});
copy();
return b.bundle()
.pipe(source('app.js'))
.pipe(buffer())
.pipe(gulp.dest('./public'))
.pipe(browserSync.stream());
};
var copy = function () {
return gulp
.src(['app/assets/index.html', 'app/styles/app.css'])
.pipe(gulp.dest('public'))
.pipe(browserSync.stream());
};
var start = function () {
build();
watch();
};
gulp.task('build', function() { return build(); });
gulp.task('start', function() { return start(); });