Skip to content

Instantly share code, notes, and snippets.

@ictus4u
Forked from liamfiddler/style.11ty.js
Created November 11, 2020 10:59
Show Gist options
  • Save ictus4u/2b20a4a91454a0b481b64a7f1913555e to your computer and use it in GitHub Desktop.
Save ictus4u/2b20a4a91454a0b481b64a7f1913555e to your computer and use it in GitHub Desktop.
Simple SCSS pipeline for 11ty
const util = require('util');
const sass = require('sass'); // `npm i -D sass`
const renderSass = util.promisify(sass.render);
const inputFile = '_includes/style.scss'; // the path to your main SCSS file
const outputFile = 'style.css'; // the filename you want this template to be saved as
module.exports = class {
data() {
return {
permalink: outputFile,
eleventyExcludeFromCollections: true,
};
}
async render() {
const result = await renderSass({
file: inputFile,
});
return result.css;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment