-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
29 lines (26 loc) · 785 Bytes
/
gulpfile.js
File metadata and controls
29 lines (26 loc) · 785 Bytes
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 sass = require('gulp-sass');
const browserSync = require('browser-sync').create();
// Compile SCSS into CSS
function style() {
// 1. Find scss file
return gulp.src('./scss/**/*.scss')
// 2. Compile throug sass compiler
.pipe(sass().on('error', sass.logError))
// 3. Where to save the CSS
.pipe(gulp.dest('./css'))
// 4. Stream changes to all browsers
.pipe(browserSync.stream())
}
function watch() {
browserSync.init({
server: {
baseDir: './'
}
});
gulp.watch('./scss/**/*.scss', style);
gulp.watch('./*.html').on('change', browserSync.reload);
gulp.watch('./*.js', style).on('change', browserSync.reload);
}
exports.style = style;
exports.watch = watch;