-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
47 lines (38 loc) · 1.04 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
const gulp = require('gulp');
const sass = require('gulp-dart-sass');
const autoprefixer = require('autoprefixer');
const postcss = require("gulp-postcss");
const cssnano = require("cssnano");
const browserSync = require('browser-sync');
const input = './scss/*.scss';
const output = './styles';
function css() {
return gulp
.src(input)
.pipe(sass({ outputStyle: "expanded" }))
.pipe(postcss([cssnano(), autoprefixer({ overrideBrowserslist: ['> 1%', 'last 8 versions', 'Firefox >= 20', 'ie >= 9'] })]))
.pipe(gulp.dest(output))
}
function init(done) {
browserSync.init(['styles/*.css', 'index.html', 'index.de.html'], {
open: false,
server: {
baseDir: './'
}
});
done();
}
function browsersyncReload(cb) {
browserSync.reload();
cb();
}
function watchTask() {
console.log("Run watch")
gulp.watch(input, gulp.series(css, browsersyncReload));
gulp.watch('*.html', browsersyncReload);
}
exports.default = gulp.series(
init,
css,
watchTask,
);