-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsvelte.config.js
46 lines (42 loc) · 1.06 KB
/
svelte.config.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
const sass = require("node-sass")
/**
* @todo Use this file in rollup.config.js to add preprocessor for TypeScript
*/
const {
preprocess,
createEnv,
readConfigFile
} = require("svelte-ts-preprocess")
const env = createEnv()
module.exports = {
preprocess: {
style: async ({ content, attributes }) => {
if (attributes.type !== "text/scss" && attributes.lang !== "scss") return // lang is now taken into account
return new Promise((resolve, reject) => {
sass.render(
{
data: content,
includePaths: ["src"],
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()
})
}
)
})
},
typescript: preprocess({
env,
compilerOptions: {
...readConfigFile(env),
allowNonTsExtensions: true,
customElement: true
}
})
}
}