-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
58 lines (49 loc) · 1.43 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
(function() {
'use strict';
var gulp = require('gulp'),
webpack = require('webpack-stream'),
stylus = require('gulp-stylus'),
bs = require('browser-sync'),
del = require('del'),
browserSync = require('browser-sync'),
reload = browserSync.reload;
// Webpack module build
gulp.task('webpack:dev', function() {
return gulp.src('src/js/master.js')
.pipe(webpack({
output: {
filename: 'bundle.js'
}
}))
.pipe(gulp.dest('dev/js'))
});
// Deletes entire build directory
gulp.task('clean:dev', function() {
return del('dev');
});
// Compiles stylus stylesheets into app/css/main.css
gulp.task('stylus:dev', function() {
return gulp.src('src/stylus/main.styl')
.pipe(stylus())
.pipe(gulp.dest('dev/css'));
});
gulp.task('watch', function() {
gulp.watch([ 'src/js/**/*.js' ], [ 'webpack:dev', reload ]);
gulp.watch([ 'src/**/*.html' ], [ 'copy:dev', reload ]);
gulp.watch([ 'src/stylus/**/*.styl' ], [ 'stylus:dev', reload ]);
});
gulp.task('copy:dev', function() {
return gulp.src('src/**/*.html')
.pipe(gulp.dest('dev'));
});
gulp.task('serve:dev', function() {
browserSync.init({
port: 8000,
server: {
baseDir: 'dev'
}
});
});
gulp.task('build:dev', [ 'webpack:dev', 'stylus:dev', 'copy:dev', 'serve:dev' ]);
gulp.task('default', [ 'build:dev', 'watch' ]);
})();