问题描述
我正在将tailwindcss与Next.JS结合使用,并在每次首次构建时均收到此错误。它没有任何问题,但我不知道为什么我要得到这个。你能帮忙吗?
tailwind.css
/* purgecss start ignore */
@tailwind base;
@tailwind components;
/* purgecss end ignore */
@tailwind utilities;
postcss.config.js
const purgecss = [
'@fullhuman/postcss-purgecss',{
// Specify the paths to all of the template files
content: [
'./layout/**/*.{js,jsx,ts,tsx}','./compoents/**/*.{js,'./pages/**/*.{js,tsx}'
],// This is the function used to extract class names from the templates
defaultExtractor: (content) => {
// Capture as liberally as possible,including things like `h-(screen-1.5)`
const broadMatches = content.match(/[^<>"'`\\s]*[^<>"'`\\s:]/g) || [];
// Capture classes within other delimiters like .block(class="w-1/2") in Pug
const innerMatches = content.match(/[^<>"'`\\s.()]*[^<>"'`\\s.():]/g) || [];
return broadMatches.concat(innerMatches);
},},];
module.exports = {
plugins: [
'tailwindcss',process.env.NODE_ENV === 'production' ? purgecss : undefined,'postcss-preset-env',],};
tailwind.config.js
module.exports = {
future: {
removeDeprecatedGapUtilities: true,purgeLayersByDefault: true,purge: [],theme: {
extend: {},variants: {},plugins: [],}
解决方法
运行
npm run dev
时,您可能会收到有关“提供了空PostCSS插件”的警告。该警告是一种{@ {1}}返回postcss.config.js
而不是PurgeCSS的假象,当您不在生产环境中时。可以安全地忽略它。