generated from binyamin/eleventy-garden
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (31 loc) · 1.21 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
// TODO: please get rid of gulp
const { task, src, dest, watch, series, parallel } = require("gulp");
const sass = require("gulp-sass");
const sourcemaps = require("gulp-sourcemaps");
const run = require("gulp-run-command").default;
const del = require("del");
sass.compiler = require("sass");
const production = process.env.NODE_ENV == "production";
const styles = "styles/*.{sass,scss,css}";
task("build:css", () => {
const source = src(styles);
const render = sass.sync().on("error", sass.logError);
const destination = dest("_site/styles");
if (production) {
return source
.pipe(render)
.pipe(destination)
} else {
return source
.pipe(sourcemaps.init())
.pipe(render)
.pipe(sourcemaps.write())
.pipe(destination)
}
})
task("build:11ty", async () => run("npx @11ty/eleventy")());
task("build", series("build:css", "build:11ty"));
task("clean", () => del("_site/", { force: true }));
task("watch:11ty", async () => run("npx @11ty/eleventy --serve --incremental")());
task("watch:css", () => watch([styles], series("build:css")));
task("dev", async () => series("build:css", parallel("watch:css", "watch:11ty"))());