我正在使用 TailwindCSS 和 Laravel Mix。我正在尝试设置 PurgeCSS,我让它读取了我的模板文件(使用 WordPress)并清除了模板文件之外的所有 CSS。
但是,作为 Tailwind 的一部分,我@apply在我的 scss 文件中使用了我正在应用的那些实用程序也被清除了,这使我的站点无法正常运行。
我的 sass 文件在css/dev其中app.scss,然后有一个目录,其中包含更多文件(base, utilities, custom, components)。
我的webpack.mix.js文件配置如下:
mix.scripts(['js/dev/app.js', 'js/dev/navigation.js', 'js/dev/skip-link-focus-fix.js'],
'js/build/app.js')
.sass('css/dev/app.scss', 'css/build')
.options({
processCssUrls: false,
postCss: [tailwindcss('./tailwind.config.js')],
})
.purgeCss({
enabled: mix.inProduction(),
// Your custom globs are merged with the default globs. If you need to
// fully replace the globs, use the underlying `paths` option instead.
globs: [
path.join(__dirname, 'template-parts/*.php'),
path.join(__dirname, '*.php'),
path.join(__dirname, 'css/dev/*.scss'),
path.join(__dirname, 'css/dev/**/*.scss'),
],
extensions: ['html', 'js', 'php', 'scss', 'css'],
});
如您所见,我尝试设置 purgeCss 的路径以查看 css 路径,但这没有用。
有谁知道如何实现这一目标?
慕勒3428872
犯罪嫌疑人X
相关分类