-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
60 lines (50 loc) · 1.22 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
49
50
51
52
53
54
55
56
57
58
59
60
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var connect = require('gulp-connect');
function buildJs(){
console.log('Rebuilding JS...');
return gulp.src('script.js')
.pipe(browserify({
transform: ['debowerify', 'babelify'],
insertGlobals : true,
ignore: 'node_modules'
}))
.pipe(gulp.dest('./build/js'));
}
function buildHtml(){
console.log('Rebuilding HTML...');
return gulp.src('index.html')
.pipe(gulp.dest('./build'));
}
function buildCss(){
console.log('Rebuilding CSS...');
return gulp.src('styles.css')
.pipe(gulp.dest('./build/css'));
}
gulp.task('javascript', function() {
buildJs();
});
gulp.task('html', function() {
buildHtml();
});
gulp.task('css', function() {
buildCss();
});
gulp.task('connect', function () {
connect.server({
root: ['./build'],
livereload: true
});
});
gulp.task('watch', function () {
gulp.watch(['script.js', 'bower_components/**/*.js'], function(){
buildJs().pipe(connect.reload());
});
gulp.watch(['styles.css'], function(){
buildCss().pipe(connect.reload());
});
gulp.watch(['index.html'], function() {
buildHtml().pipe(connect.reload());
});
});
gulp.task('default', ['javascript', 'html', 'css', 'connect', 'watch']);