-
我想知道,使用Tailwindcss后,如果想要发布修改后的主题(由Vuepress默认主题修改),怎么处理tailwind的配置文件? |
Beta Was this translation helpful? Give feedback.
Answered by
kirazZ1
Dec 12, 2022
Replies: 1 comment
-
这个问题我也有遇到过,是因为传入插件 if (app.options.bundler.name === '@vuepress/bundler-vite') {
const options = defaultViteBundlerConfig()
const viteBundlerOptions = mergeViteBundlerConfig(options, userConfig)
// @ts-ignore
app.options.bundler = viteBundler(viteBundlerOptions)
} else {
// @ts-ignore
app.options.bundler = webpackBundler({
postcss: {
postcssOptions: {
plugins: [
['tailwindcss', tailwindcssConfig],
['autoprefixer', {}],
[require('tailwindcss/nesting')],
['postcss-each']
]
},
},
})
} 可以看到无论在vite还是在webpack的打包配置中,是有传入对应的配置的,配置如下: export const defaultViteBundlerConfig = (): ViteBundlerOptions => ({
viteOptions: {
css: {
postcss: {
plugins: [
postcssImport,
tailwindcssNesting,
tailwindcss(tailwindcssConfig as unknown as Config), // 如果这里传入的是undefined就会出现如图报错
autoprefixer({}),
postcssEach
]
}
},
}
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
NeserCode
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这个问题我也有遇到过,是因为传入插件
tailwindcss
的配置是undefined
造成的。在此项目中对应传入配置的代码如下: