作者:cy45vsf | 来源:互联网 | 2023-09-24 10:16
出于某种原因,一些样式似乎不适用于Netlify上托管的生产版本。这似乎只发生在单个组件上。它是一个位于./layout/FormLayout.tsx(不知道
出于某种原因,一些样式似乎不适用于 Netlify 上托管的生产版本。这似乎只发生在单个组件上。它是一个位于./layout/FormLayout.tsx
(不知道这是否会改变任何东西)的包装器。这是包装器:
const FormLayout: React.FC = ({ children, title, description }) => {
return (
{title}
{description && (
{description}
)}
{children}
)
}
它在这里使用:
const Register: React.FC = () => {
return (
{/* form stuff. styles do work in here */}
)
}
下面是一些配置文件:
顺风配置:
module.exports = {
purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
darkMode: 'class',
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}
postcss 配置:
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
这是正在发生的事情的图形示例:
对于我的构建命令,我使用next build && next export
和 Netlify 部署/out
目录。
所有代码都在这里通过github
回答
对于将来看到这一点的任何人,只需将purge
数组中任何新文件夹的路径添加到 tailwind 配置中,如下所示:
module.exports = {
purge: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./layout/**/*.{js,ts,jsx,tsx}',
'./helpers/**/*.{js,ts,jsx,tsx}',
// Add more here
],
darkMode: 'class',
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}