From 2e3509de0e9543c7c61c95211444535314b76379 Mon Sep 17 00:00:00 2001 From: yuki Date: Thu, 27 Mar 2025 05:14:42 -0300 Subject: [PATCH] update sass support --- eleventy.config.js | 21 +++++++++++++++++++++ package.json | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 eleventy.config.js diff --git a/eleventy.config.js b/eleventy.config.js new file mode 100644 index 0000000..39588ef --- /dev/null +++ b/eleventy.config.js @@ -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; + }; + }, + }); +}; + diff --git a/package.json b/package.json index 6d9a0f6..589384b 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "watch:eleventy": "npx @11ty/eleventy --watch", "watch:sass": "npx sass sass:_site/css --watch", - "start": "npm run watch:eleventy & npm run watch:sass" + "start": "npm run watch:eleventy" }, "keywords": [], "author": "yuki",