-
Notifications
You must be signed in to change notification settings - Fork 273
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
Missing style output when globalStyle and layer rules are used together #1113
Comments
Supplementation. This reproduces not only the export const a1 = globalStyle(':root', {
'@media': {
all: {
color: 'red'
}
}
});
export const a2 = globalStyle(':root', {
'@media': {
all: {
background: 'red'
}
}
}); ↓ output @media all {
:root {
background: red;
}
} If a different selector is specified, the problem does not reproduce. export const a1 = globalStyle(':root', {
'@media': {
all: {
color: 'red'
}
}
});
export const a2 = globalStyle('.hoge', {
'@media': {
all: {
background: 'red'
}
}
}); ↓ output @media all {
:root {
color: red;
}
.hoge {
background: red;
}
} |
*This is a comment that I am including in the hope that I can help in the investigation. Please forgive me. for (const [serialisedFileScope, fileScopeCss] of cssByFileScope) {
const fileScope = parseFileScope(serialisedFileScope);
const css = transformCss.transformCss({
localClassNames: Array.from(localClassNames),
composedClassLists,
cssObjs: fileScopeCss
}).join('\n'); The
|
Then, when the following export function transformCss({
localClassNames,
cssObjs,
composedClassLists,
}: TransformCSSParams) {
const stylesheet = new Stylesheet(localClassNames, composedClassLists);
for (const root of cssObjs) {
stylesheet.processCssObj(root);
} |
Then I arrived at the code here. const activeConditionalRuleset =
this.conditionalRulesets[this.conditionalRulesets.length - 1];
if (
!activeConditionalRuleset.mergeIfCompatible(this.currConditionalRuleset)
) {
// Ruleset merge failed due to incompatibility. We now deopt by starting a fresh ConditionalRuleset
this.conditionalRulesets.push(this.currConditionalRuleset);
} When the problem occurs, I think the |
Describe the bug
When globalStyle and layer rules are used together in a single file, all but the last rule defined will be missing from the output.
Expected Output
Actual output
Reproduction
https://stackblitz.com/edit/stackblitz-starters-8jxr3t?description=Starter%20project%20for%20Node.js,%20a%20JavaScript%20runtime%20built%20on%20Chrome%27s%20V8%20JavaScript%20engine&file=issue.mjs,package.json&title=node.new%20Starter
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: