-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
taro使用@tarojs/plugin-html插件时,会导致不生成css变量,导致某些样式不生效,例如rotate-45,这个和本插件无关,单独使用tailwindcss也有这个问题 #155
Comments
我的配置就是默认的: /** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{html,js,ts,jsx,tsx}"],
theme: {
extend: {},
},
plugins: [],
corePlugins: {
preflight: false
}
} 这样的,我看你最前面发的第一张是有 view,::before,::after 这个选择器来注入所有的css变量的 |
那个是1.x.x的版本,我现在的项目没有生成view,::before,::after选择器,可能是这个原因,我再看下是不是我这个项目的原因 |
我大概知道原因了,你能发一下你的 tailwindcss 版本和打包出来的 dist/app.wxss 内容嘛,我怀疑是选择器没有被更新替换,可能是我 2.x.x 更改了css变量注入域的判断标准导致的。 |
生成的是上面的两个选择器 |
奇怪了,主css变量注入的块丢了,是不是什么插件把它干掉了,要不加群大家一起看看吧,就在置顶issue里。 |
|
我fork了这个模板,下载了之后发现,即使我卸载了我这个插件,重新安装。运行 |
调试之后找到问题了,是 @tarojs/plugin-html 导致的,注释掉这个css变量注入块的选择器就出来了,具体细节要在研究研究。 |
OK,感谢回复 |
我看了下@tarojs/plugin-html,它好像会默认把微信小程序不兼容的选择器去除掉 |
是的,看上去这时候需要配置一下这个插件: config = {
// ...
mini: {
// ...
postcss: {
htmltransform: {
enable: true,
config: {
removeCursorStyle: false,
}
},
},
},
} 把默认的去除关闭,不然整个 https://taro-docs.jd.com/docs/use-h5#%E6%8F%92%E4%BB%B6-postcss-%E9%85%8D%E7%BD%AE%E9%A1%B9 |
@tarojs/plugin-htm内部使用了一个叫做postcss-html-transform的插件,可以在
把它关了好像就可以了,但是不知道会不会影响到 |
|
额,是由于 |
估计是这个组件库估计需要开启 |
同样遇到这个问题 |
3.6.11有效 |
同样遇到这个问题,感谢大佬🫶 解决的配置: chain.merge({
plugin: {
install: {
plugin: UnifiedWebpackPluginV5,
args: [{
appType: 'taro',
injectAdditionalCssVarScope: true, // 配置此字段为 true 即可
}],
},
},
}) |
2.x.x没有生成


The text was updated successfully, but these errors were encountered: