-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
66 lines (56 loc) · 1.44 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
61
62
63
64
65
var
gulp = require('gulp'),
config = require('./config/gulp'),
del = require('del'),
nodemon = require('gulp-nodemon'),
browserSync = require('browser-sync').create()
;
// CLEAN
gulp.task('clean', function() {
return del(config.paths.dist_dir);
});
// VIEWS
gulp.task('dev:views', function() {
return gulp
.src(config.paths.views.src)
//Process views
.pipe(gulp.dest(config.paths.views.dist))
})
gulp.task('watch:views', function(done) {
gulp.watch(config.paths.views.src, gulp.series('dev:views'));
done();
})
//STYLES
gulp.task('dev:styles', function() {
return gulp
.src(config.paths.styles.src)
//Process styles
.pipe(gulp.dest(config.paths.styles.dist))
})
gulp.task('watch:styles', function(done) {
gulp.watch(config.paths.styles.src, gulp.series('dev:styles'));
done();
})
//SERVER
gulp.task('server', function (cb) {
var called = false;
return nodemon(config.plugins.nodemon)
.on('start', function () {
if (!called) {
called = true;
cb();
}
})
});
// BROWSER-SYNC
function browserSyncInit(done) {
browserSync.init(config.plugins.browserSync)
done();
}
gulp.task('browser-sync', browserSyncInit);
//DEV
gulp.task('dev', gulp.parallel('dev:styles', 'dev:views'));
//WATCH
gulp.task('watch', gulp.parallel('watch:styles', 'watch:views'));
//DEFAULT
gulp.task('default', gulp.series('clean', 'dev', 'server', gulp.parallel('watch','browser-sync')));