-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
50 lines (44 loc) · 1.17 KB
/
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
41
42
43
44
45
46
47
48
49
50
const gulp = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const autoprefixer = require('gulp-autoprefixer');
const browserSync = require('browser-sync');
const paths = {
sass: {
src: 'sass/style.scss',
dest: 'demo/',
watch: 'sass/**'
},
html: {
watch: 'demo/**/*.html'
}
};
const runSass = () => {
return gulp.src(paths.sass.src)
.pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError))
.pipe(autoprefixer({
cascade: false
}))
.pipe(gulp.dest(paths.sass.dest))
.pipe(browserSync.stream({ match: '**/*.css' }));
};
const bs = () => {
browserSync({
server: {
baseDir: "demo",
directory: true
},
open: false
});
};
exports.watch = gulp.series(runSass, () => {
browserSync.init({
server: {
baseDir: "demo",
directory: true
},
open: false
});
gulp.watch(paths.sass.watch, gulp.series(runSass));
gulp.watch(paths.html.watch).on('change', browserSync.reload);
})
exports.default = gulp.series(runSass);