-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGulpfile.js
40 lines (34 loc) · 980 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
30
31
32
33
34
35
36
37
38
39
40
const gulp = require('gulp');
const sass = require('gulp-sass');
const sourcemaps = require('gulp-sourcemaps');
const browserSync = require('browser-sync').create();
gulp.task('browserSync', () => {
browserSync.init({
server: {
baseDir: 'src'
},
})
});
gulp.task('sass', () => (
gulp.src('src/scss/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass.sync().on('error', sass.logError))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('./src/css'))
.pipe(browserSync.reload({
stream: true
}))
));
gulp.task('watch', () => {
gulp.watch('src/scss/**/*.scss', ['sass'])
.on('change', (event) => {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
});
gulp.watch('src/*.html', browserSync.reload);
});
gulp.task('sass:watch', ['browserSync', 'sass'], () => (
gulp
.watch('src/scss/**/*.scss', ['sass'])
));
gulp.task('default', ['sass', 'sass:watch']);
gulp.task('build', ['sass']);