【发布时间】:2023-02-16 18:47:43
【问题描述】:
在我的SvelteKit 项目中,我使用的是 SCSS,为了包含一些在整个项目中使用的 mixins,我从 vitePreprocess 切换到 svelte-preprocess 并在它们前面加上 scss.prependData。现在我的配置看起来像这样:
const config = {
preprocess: preprocess({
scss: {
prependData: `@import './src/styles/prepend.scss';`,
},
}),
// ..
// Other options not relevant to the question
}
由于the official SvelteKit docs建议vitePreprocessmight be faster,我想知道我是否可以用它设置全局混合。
我尝试在我的根 +layout.svelte 文件中导入 prepend.scss,但现在我收到 Undefined mixin 错误。
我可以将 mixins 与 vitePreprocess 一起使用吗,或者 svelte-preprocess 目前是实现此目的的唯一方法吗?
【问题讨论】: