-
Notifications
You must be signed in to change notification settings - Fork 253
Closed
Description
The below code outputs .foo{color:red;@light{&{color:green}}@dark{&{color:#ff0}}}. Each rule works on their own, for example if I delete the light rule then the dark rule works: .foo{color:red;@light{&{color:green}}@media (prefers-color-scheme:dark){&{color:#ff0}}}.
let { code, map } = transform({
filename: 'test.css',
minify: true,
code: new TextEncoder().encode('.foo{color: red;@light {color: green;}; @dark {color:yellow;}}'),
customAtRules: {
light: {
prelude: null,
body: 'style-block'
},
dark: {
prelude: null,
body: 'style-block'
}
},
visitor: composeVisitors([{
Rule: {
custom: {
light({ body, loc }) {
return {
type: 'media',
value: {
rules: body.value,
loc,
query: {
mediaQueries: [
{
raw: '(prefers-color-scheme: light)'
}
]
}
}
}
},
}
}
},
{
Rule: {
custom: {
dark({ body, loc }) {
return {
type: 'media',
value: {
rules: body.value,
loc,
query: {
mediaQueries: [
{
raw: '(prefers-color-scheme: dark)'
}
]
}
}
}
},
}
}
}]),
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels