-
-
Save dexbyte/b55747a72f23bc854aaa52a1207df4ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sass = require('node-sass'); | |
// related: https://github.com/UnwrittenFun/svelte-vscode/issues/1 | |
module.exports = { | |
preprocess: { | |
style: async ({ content, attributes }) => { | |
if (!['text/sass', 'text/scss'].some(attributes.type) && !['sass', 'scss'].some(attributes.lang)) return; | |
return new Promise((resolve, reject) => { | |
sass.render( | |
{ | |
data: content, | |
sourceMap: true, | |
outFile: 'x', // this is necessary, but is ignored | |
}, | |
(err, result) => { | |
if (err) return reject(err); | |
resolve({ | |
code: result.css.toString(), | |
map: result.map.toString(), | |
}); | |
}, | |
); | |
}); | |
}, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment