我正在尝试用nuxt.js 2.0上传一个基本的tailwind.css项目。我用:
yarn add --dev tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9安装尾风系统2.0
首先,我使用npm,然后纱线,但在部署尾风2.0不起作用。在当地,效果很好。
发布于 2021-02-14 20:17:22
如果没有更多的详细信息,我是无法判断的,但是如果您在生产中遇到了困难,而没有在开发尾风项目时遇到困难,那么首先要检查的是您是否使用了动态类名(例如text-${color}-500)。生产中的这些将被清除,除非您将它们添加到允许列表中。
更新
看了一下您提供的回购,问题似乎是Tailwind生成了针对[type='text']的CSS,但这是由html-minifier在您的Nuxt应用程序生成的HTML中清除的(参见问题)。可以在nuxt.config中使用此代码关闭此行为。
export default {
build: {
html: {
minify: {
collapseBooleanAttributes: true,
decodeEntities: true,
minifyCSS: true,
minifyJS: true,
processConditionalComments: true,
removeEmptyAttributes: true,
// this is the only line we're changing from defaults
// but we have to include all as they aren't merged
removeRedundantAttributes: false,
trimCustomFragments: true,
useShortDoctype: true
}
}
}
}https://stackoverflow.com/questions/66175665
复制相似问题