-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
39 lines (31 loc) · 853 Bytes
/
.eleventy.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
const sass = require("sass");
const fs = require("fs-extra");
module.exports = (eleventyConfig) => {
// pass files directly through to the output
eleventyConfig.addPassthroughCopy({
"src/js": "js",
"src/site/images" : "images"
});
// watch the scss source files in case of need to regenerate
eleventyConfig.addWatchTarget("src/scss/");
// Compile Sass before a build
eleventyConfig.on("beforeBuild", () => {
let result = sass.renderSync({
file: "src/scss/main.scss",
sourceMap: false,
outputStyle: "compressed",
});
fs.ensureDirSync('dist/css/');
fs.writeFile("dist/css/main.css", result.css, (err) => {
if (err) throw err;
console.log("CSS generated");
});
});
// where do things live?
return {
dir: {
input: "src/site",
output: "dist"
}
};
};