-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Add 'file' param support on config files [ module.exports = (ctx: { cwd, env, *file }) => ${config} ] #4653
Comments
related: #3336 |
I agree that it would be advantageous to have access to the current file path being processed by PostCSS. My specific use case at the present is a 3rd party toast notification library that, by default (and non-configurable), attaches its toast messages directly to However, if the // postcss.config.js
module.exports = (ctx) => {
return {
plugins: {
'postcss-scopify': !ctx.file.match(/ignoreme/) ? '#my-custom-scope' : false
}
}
} |
Is there a solution? |
这样写有效果
|
看了看,vite用了postcss config的cache,如果启动了path,得移除这个cache |
真是一个机灵鬼 |
IIUC, adding a |
这样似乎会使插件执行两次 |
Just checked |
Given that there is a workaround and these look like an edge case for Vite users in general, I agree with @bluwy. Let's close for now and if someone has a good use case to justify adding the complexity to core that can't be implemented otherwise please create a new issue linked to this one. |
Clear and concise description of the problem
postcss.config.js 配置中无法获取到file,导致无法去区分不同尺寸的UI来做转换(例如vant的设计图尺寸为375,而其他为750)
Suggested solution
postcss.config.js中增加file参数
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: