-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
28 lines (25 loc) · 775 Bytes
/
gulpfile.js
File metadata and controls
28 lines (25 loc) · 775 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const browserSync = require('browser-sync').create();
//scss to css
function style() {
//grab scss file and compile to css
return gulp.src('./src/scss/**/*.css')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css'))
//browser sync
.pipe(browserSync.stream());
}
function watch() {
browserSync.init({
server: {
baseDir: './src'
}
});
//watch for changes and reload page as necessary
gulp.watch('./src/scss/**/*.scss', style);
gulp.watch('./src/**/*.html').on('change', browserSync.reload);
gulp.watch('./src/js/**/*.js').on('change', browserSync.reload);
}
exports.style = style;
exports.watch = watch;