如何使用 Tailwind CSS 跟踪位于文件夹中的每个 PHP 文件
How to track every PHP file located in a folder with Tailwind CSS
我在我的项目中使用 Tailwind CSS,我想将我所有的 PHP 文件包含在 tailwind.config.js
文件中。我想用通配符,但是好像不行
这个有效:
module.exports = {
content: [
"./${themePath}/index.php",
"./${themePath}/header.php",
"./${themePath}/footer.php",
],
}
这不是:
module.exports = {
content: [
"./${themePath}/*.{php}",
"./${themePath}/**/*.{php}",
],
}
我使用 Laravel Mix 进行资产编译,Tailwind 当然包含在 webpack.min.js
文件中,如果我在 Tailwind 的配置中指定文件路径,它会很好地工作——但是通配符不起作用。
可能吗?
解决方案似乎是使用一些可以搜索这些文件的 third-party 库,例如 fast-glob(Node.js 的 glob 库)。
module.exports = {
content: require('fast-glob').sync([
'./${themePath}/**/*.{php}',
]),
}
有效。
我在我的项目中使用 Tailwind CSS,我想将我所有的 PHP 文件包含在 tailwind.config.js
文件中。我想用通配符,但是好像不行
这个有效:
module.exports = {
content: [
"./${themePath}/index.php",
"./${themePath}/header.php",
"./${themePath}/footer.php",
],
}
这不是:
module.exports = {
content: [
"./${themePath}/*.{php}",
"./${themePath}/**/*.{php}",
],
}
我使用 Laravel Mix 进行资产编译,Tailwind 当然包含在 webpack.min.js
文件中,如果我在 Tailwind 的配置中指定文件路径,它会很好地工作——但是通配符不起作用。
可能吗?
解决方案似乎是使用一些可以搜索这些文件的 third-party 库,例如 fast-glob(Node.js 的 glob 库)。
module.exports = {
content: require('fast-glob').sync([
'./${themePath}/**/*.{php}',
]),
}
有效。