-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
34 lines (28 loc) · 845 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
const { src, dest, series, watch } = require('gulp');
const sourcemaps = require('gulp-sourcemaps');
const sass = require('gulp-sass');
const browserSync = require('browser-sync')
const minifyCSS = require('gulp-csso');
browserSync({
server: {
baseDir: '.'
},
notify: false,
});
const styles = function styles() {
return src('src/sass/main.scss')
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(minifyCSS())
.pipe(sourcemaps.write())
.pipe(dest('distr/css'))
.pipe(browserSync.reload({ stream: true }));
}
const browserWatch = function browserWatch() {
watch("src/sass/**/*.scss", series(styles));
watch("index.html").on('change', browserSync.reload);
}
module.exports = {
default: styles,
serve: series(styles, browserWatch)
}