-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (38 loc) · 1.01 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
// Gulp requirements.
var gulp = require('gulp');
var sass = require('gulp-sass')(require('sass'));
var filter = require('gulp-filter');
var browserSync = require('browser-sync').create();
// Convert SCSS to CSS.
function scssTask() {
return gulp.src('app/assets/scss/**/*.scss')
.pipe(filter(['**', '!app/assets/scss/modules/*.scss']))
.pipe(sass())
.pipe(gulp.dest('app/assets/css'));
}
// Init Browser Sync.
function browserSyncServe(cb) {
browserSync.init({
server: {
baseDir: 'app'
},
});
cb();
}
// Reload the page with Browser Sync.
function browserSyncReload(cb) {
browserSync.reload();
cb();
}
// Watch for changes.
function watchTask() {
gulp.watch('app/*.html', browserSyncReload);
gulp.watch(['app/assets/scss/**/*.scss'], gulp.series(scssTask, browserSyncReload));
}
// Tasks to execute on "gulp" or "npm run dev" commands.
exports.default = gulp.series(
scssTask,
browserSyncServe,
browserSyncReload,
watchTask
);