Repository navigation
fix(css-cascade-layers): let the next plugins process the nodes they insert in the layer - #13123
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
…insert in the layer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
454c45a to
9035f92
Compare
Motivation
Found while working on #13088.
When it wraps a file in
@layer,@docusaurus/plugin-css-cascade-layersappends a plain{type: 'atrule', nodes}object holding the nodes of a root clone. PostCSS adopts that object as-is and doesn't fix theparentof its children: the wrapped rules still point to the detached clone. When a later plugin inserts a node, PostCSS marks the clone as dirty instead of the real tree, and no plugin visits the new node.The plugin now moves the root nodes into a real
AtRule, created with theAtRulehelper that PostCSS passes toOnce.On sites whose Browserslist targets old browsers (like the
defaultsquery, which includesop_mini all), it fixes the CSS of the wrapped files::not(#\#)instead of 516, the same as a file with the@layerwritten in its source.light-dark()fallback.var()fallbacks of preset-env.With the Docusaurus default Browserslist queries (
baseline widely available), the output is byte-identical.Test Plan
The output of the unit test added by #13122 now has the inserted fallback flipped:
right:1px;right:var(--width)instead ofleft:1px;right:var(--width).Test links
Deploy preview: https://deploy-preview-13123--docusaurus-2.netlify.app/
Related issues/PRs
Stacked on #13122
🤖 Generated with Claude Code
Summary by CodeRabbit