如何处理 Tailwind 和 PurgeCSS 以及大量不同的文件夹?

How to deal with Tailwind & PurgeCSS and A LOT of different folders?

我一直在使用带有“清除”选项的 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 文件的小型项目示例。所以我的问题是:有没有办法更有效地做到这一点,或者我必须像以前那样做?

您不必定位每个子文件夹,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'
    ]
}