forked from htmlacademy-adaptive/2057771-cat-energy-28
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
41 lines (34 loc) · 866 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
import gulp from "gulp";
import plumber from "gulp-plumber";
import less from "gulp-less";
import postcss from "gulp-postcss";
import autoprefixer from "autoprefixer";
import browser from "browser-sync";
// Styles
export const styles = () => {
return gulp
.src("source/less/style.less", { sourcemaps: true })
.pipe(plumber())
.pipe(less())
.pipe(postcss([autoprefixer()]))
.pipe(gulp.dest("source/css", { sourcemaps: "." }))
.pipe(browser.stream());
};
// Server
const server = (done) => {
browser.init({
server: {
baseDir: "source",
},
cors: true,
notify: false,
ui: false,
});
done();
};
// Watcher
const watcher = () => {
gulp.watch("source/less/**/*.less", gulp.series(styles));
gulp.watch("source/*.html").on("change", browser.reload);
};
export default gulp.series(styles, server, watcher);