-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
42 lines (35 loc) · 905 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
41
42
const { src, dest, watch,series } = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const browsersync = require('browser-sync').create();
const scssPath = 'Website/src/scss/**/*.scss';
const cssPath = 'Website/dist/css/';
function css(){
return src(scssPath)
.pipe(sass())
.pipe(postcss([autoprefixer('last 2 versions'), cssnano()]))
.pipe(dest(cssPath))
}
function browsersyncServe(cb){
browsersync.init({
server: {
baseDir: '.'
}
});
cb();
}
function browsersyncReload(cb){
browsersync.reload();
cb();
}
function watchTask(){
watch('*.html', browsersyncReload);
watch(scssPath, series(css, browsersyncReload));
}
exports.default = series(
css,
browsersyncServe,
watchTask
);