-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (50 loc) · 1.15 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
51
52
53
54
55
56
57
58
59
import gulp from "gulp";
const { watch, series } = gulp;
import BrowserSync from "browser-sync";
import execa from "execa";
const browserSync = BrowserSync.create();
// print output of commands into the terminal
const stdio = "inherit";
async function toast() {
await execa("toast", ["incremental", "."], { stdio });
browserSync.reload();
}
function clean(cb) {
// place code for your default task here
console.log("In clean");
cb();
}
async function css() {
await execa(
"postcss",
[
"--config",
"commonjs",
"src/index.css",
"-o",
"public/styles.css",
"--env",
"production",
],
{ stdio }
);
await execa("yarn", ["copy:css"], { stdio });
browserSync.reload("*.css");
}
function watchAll(cb) {
browserSync.init({
server: {
baseDir: "./public",
},
serveStatic: ["./public"],
serveStaticOptions: {
extensions: ["html"], // pretty urls
},
});
watch("src/**/*.css", css);
watch(["src/**/*.js", "src/**/*.mdx"], series(clean, css, toast));
cb();
}
const defaultTask = series(css, toast, watchAll);
export { watchAll, css, toast };
export default defaultTask;