-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
53 lines (47 loc) · 997 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
43
44
45
46
47
48
49
50
51
52
53
import gulp from "gulp";
import browser from "browser-sync";
import plumber from "gulp-plumber";
import postcss from "gulp-postcss";
import autoprefixer from "autoprefixer";
import csso from "postcss-csso";
import rename from "gulp-rename";
const { src, dest, watch, series } = gulp;
export function processStyles () {
return src("./styles/style.css")
.pipe(plumber())
.pipe(postcss([
autoprefixer(),
csso()
]))
.pipe(
rename({
extname: ".min.css"
})
)
.pipe(dest("./styles/"))
.pipe(browser.stream());
}
export function startServer (done) {
browser.init({
server: {
baseDir: "./"
},
cors: true,
notify: false,
ui: false,
});
done();
}
function reloadServer (done) {
browser.reload();
done();
}
function watchFiles () {
watch("./styles/style.css", series(processStyles));
watch("./**/*.html", series(reloadServer));
}
export default series(
processStyles,
startServer,
watchFiles
);