【问题标题】:How to load global (PostCSS) styles in Sapper?如何在 Sapper 中加载全局(PostCSS)样式?
【发布时间】:2020-06-28 02:48:55
【问题描述】:

在将Tailwind CSS与Svelte集成时,可以添加使用svelte-preprocess将以下内容添加到App.svelte

<style global>
  @tailwind base;                                                                                                                                     
  @tailwind components;                                                                                                                               
  @tailwind utilities;  
</style>

这将正确加载基本样式。

但是,在迁移到 Sapper 后将这些样式移动到 routes/index.svelteroutes/_layout.svelte 并不能起到相同的作用。

Svelte 编译器抛出错误“end must be greater than start”。

【问题讨论】:

    标签: svelte sapper


    【解决方案1】:

    创建 Tailwind.svelte

    然后添加

        <style global>
      @tailwind base;                                                                                                                                     
      @tailwind components;                                                                                                                               
      @tailwind utilities;  
    </style>
    

    将 Tailwind.svelte 导入到 _layout.svelte

    【讨论】:

      猜你喜欢
      • 2021-11-07
      • 2017-09-26
      • 2012-07-25
      • 2016-09-10
      • 2016-10-24
      • 2019-01-06
      • 1970-01-01
      • 2019-06-07
      • 2022-11-10
      相关资源
      最近更新 更多