-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
29 lines (25 loc) · 858 Bytes
/
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
const gulp = require('gulp');
const browserSync = require('browser-sync').create();
const sass = require('gulp-sass');
// compile scss into css
function style() {
// find scss file (custom file necessary to include changes made here during every browser reload)
return gulp.src(['./src/sass/*.scss', './src/sass/custom/*.scss'])
// pass file through scss compiler
.pipe(sass().on('error', sass.logError))
// save compiled css
.pipe(gulp.dest('./src/public/css/'))
// stream changes to all browsers
.pipe(browserSync.stream());
}
function watch() {
browserSync.init({
server: {
baseDir: './src'
}
});
gulp.watch(['./src/sass/*.scss', './src/sass/custom/*.scss'], style);
gulp.watch('./src/*.html').on('change', browserSync.reload);
}
exports.style = style;
exports.watch = watch;