update sass support
This commit is contained in:
parent
cfbc244381
commit
2e3509de0e
2 changed files with 22 additions and 1 deletions
21
eleventy.config.js
Normal file
21
eleventy.config.js
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
const sass = require("sass");
|
||||||
|
|
||||||
|
module.exports = function (eleventyConfig) {
|
||||||
|
eleventyConfig.addTemplateFormats("scss");
|
||||||
|
|
||||||
|
// Creates the extension for use
|
||||||
|
eleventyConfig.addExtension("scss", {
|
||||||
|
outputFileExtension: "css", // optional, default: "html"
|
||||||
|
|
||||||
|
// `compile` is called once per .scss file in the input directory
|
||||||
|
compile: async function (inputContent) {
|
||||||
|
let result = sass.compileString(inputContent);
|
||||||
|
|
||||||
|
// This is the render function, `data` is the full data cascade
|
||||||
|
return async (data) => {
|
||||||
|
return result.css;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"watch:eleventy": "npx @11ty/eleventy --watch",
|
"watch:eleventy": "npx @11ty/eleventy --watch",
|
||||||
"watch:sass": "npx sass sass:_site/css --watch",
|
"watch:sass": "npx sass sass:_site/css --watch",
|
||||||
"start": "npm run watch:eleventy & npm run watch:sass"
|
"start": "npm run watch:eleventy"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "yuki",
|
"author": "yuki",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue