-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsvelte.config.js
More file actions
33 lines (30 loc) · 850 Bytes
/
svelte.config.js
File metadata and controls
33 lines (30 loc) · 850 Bytes
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
const sass = require("node-sass");
// This adds Language Server Protocol support for tools like vscode
// 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()
});
}
);
});
}
}
};