【发布时间】:2021-01-19 15:06:47
【问题描述】:
我将 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,jsx,ts,tsx}',
'./pages/**/*.{js,jsx,ts,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: [],
}
【问题讨论】:
-
你知道了吗,我刚开始遇到同样的问题。
标签: next.js tailwind-css