-
-
Notifications
You must be signed in to change notification settings - Fork 780
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
about dynamic attributify mode #1915
Comments
I don't think it's a problem, UnoCSS will extract Of course you can use |
We temporarily close this due to the lack of enough information. |
|
It doesn't seem to be antd5 problem either |
This does not affect anything, because unocss is a static analysis, and extracts the token to generate css. |
I don't understand how this could be invalid, it's working in windicss.. |
@Handpear I made a PR to fix this issue: #1921 In the meantime, you could use this roughly written extractor: export default defineConfig({
extractors: [{
name: 'ternary-extractor',
extract(ctx) {
let s = ctx.code
const results = []
const re = /<[\w.]+[^>]*?:?(?:([\w-]+)=[{'"](.+?(?:.)*?\?+(?:.)*?(?:['"]([^'"]+)['"]?(?:.)*?:(?:.)*?['"]([^'"]+)['"]?))[}'"](?:.)*?)+/gms
let match
while (match = re.exec(s)) {
s = s.replace(match[2], '')
re.lastIndex = 0
const attr = match[1]
if(attr === 'class' || attr === 'className') continue
const left = match[3]
left.split(' ').forEach(i => results.push(`[${attr}~="${i}"]`))
const right = match[4]
right.split(' ').forEach(i => results.push(`[${attr}~="${i}"]`))
console.log(results)
}
return results
},
}], |
@sibbng Thank you |
Hello guys,
I have a class need to use attributify mode,
pos="!fixed"
it's workingpos={isSideFixed ? '!fixed' : 'relative'}
it's not workingHow do I get the corresponding css generated in advance? using the
safelist
?The text was updated successfully, but these errors were encountered: