【问题标题】:How to use vitePreprocess with global SCSS mixins in SvelteKit?如何在 SvelteKit 中将 vitePreprocess 与全局 SCSS 混合使用?
【发布时间】: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 目前是实现此目的的唯一方法吗?

【问题讨论】:

    标签: svelte vite sveltekit


    【解决方案1】:

    你解决了吗? 我试过了但做不到。

    【讨论】:

      猜你喜欢
      • 2021-11-08
      • 2018-11-19
      • 2020-12-22
      • 2018-07-01
      • 1970-01-01
      • 2020-09-03
      • 2020-12-31
      • 2020-03-31
      • 1970-01-01
      相关资源
      最近更新 更多