-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
44 lines (37 loc) · 1.44 KB
/
index.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
/*
Copyright the eleventy-plugin-fluid copyright holders.
See the AUTHORS.md file at the top-level directory of this distribution and at
https://github.com/fluid-project/eleventy-plugin-fluid/raw/main/AUTHORS.md.
Licensed under the New BSD license. You may not use this file except in compliance with this License.
You may obtain a copy of the New BSD License at
https://github.com/fluid-project/eleventy-plugin-fluid/raw/main/LICENSE.md.
*/
import compileSass from "./src/compilers/compile-sass.js";
import eleventyUtils from "@11ty/eleventy-utils";
const fluidSassPlugin = {
initArguments: {},
configFunction: function (eleventyConfig, options = {}) {
options = eleventyUtils.Merge({
basePath: `./${eleventyConfig.dir.input || "src"}/assets/styles`,
minify: true,
sourceMap: false,
drafts: {
nesting: true
},
browserslist: "> 1%"
}, options);
eleventyConfig.addTemplateFormats("scss");
eleventyConfig.addExtension("scss", {
outputFileExtension: "css",
getData: async function () {
return {
eleventyExcludeFromCollections: true
};
},
compile: async function (inputContent, inputPath) {
return await compileSass(inputContent, inputPath, options, this);
}
});
}
};
export default fluidSassPlugin;