【问题标题】:How to deal with Tailwind & PurgeCSS and A LOT of different folders?如何处理 Tailwind 和 PurgeCSS 以及很多不同的文件夹?
【发布时间】:2021-05-05 20:01:35
【问题描述】:

我一直在使用带有“清除”选项的 Tailwind,以使最终的 css 文件更小且成功。但是,我一直想知道我的方法的效率。我正在处理有很多子文件夹的项目,我都指定如下:

 purge: {
        layers: ['components', 'utilities', 'base'],
        content: [
            '../A.Umb.E.Platform.Frontend/Assets/**/*.css',
            '../A.Umb.E.Platform.Vue/src/Apps/ESearch/*.vue',
            '../A.Umb.E.Platform.Vue/src/Apps/ESearch/Components/*.vue',
            '../A.Umb.E.Platform.Vue/src/Apps/HSearch/*.vue',
            '../A.Umb.E.Platform.Vue/src/Apps/HSearch/Components/*.vue',
            '../A.Umb.E.Platform.Web/Views/**/*.cshtml',
            '../A.Umb.E.Platform.Web/Views/**/**/*.cshtml',
            '../A.Umb.E.Platform.Web/Views/**/**/**/*.cshtml',
            '../A.Umb.E.Platform.Web/Views/**/**/**/**/*.cshtml',

        ]
    }

我一直在寻找这种低效方法的解决方案,但我能找到的只是在同一文件夹中只有几个 html 或 vue 文件的小型项目的示例。所以我的问题是:有没有办法更有效地做到这一点,还是我必须像我已经做过的那样做?

【问题讨论】:

    标签: tailwind-css css-purge


    【解决方案1】:

    您不必定位每个子文件夹,glob 模式会为您匹配这些。使用 ** 将匹配零个或多个文件夹。

    purge: {
        layers: ['components', 'utilities', 'base'],
        content: [
            '../A.Umb.E.Platform.Frontend/Assets/**/*.css',
            '../A.Umb.E.Platform.Vue/src/Apps/**/*.vue',
            '../A.Umb.E.Platform.Web/Views/**/*.cshtml'
        ]
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-01-15
      • 1970-01-01
      • 1970-01-01
      • 2018-07-22
      • 2013-03-29
      • 1970-01-01
      • 1970-01-01
      • 2014-04-28
      相关资源
      最近更新 更多