feat(core): add allLayers option to output all layer names#5057
Conversation
✅ Deploy Preview for unocss ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
commit: |
There was a problem hiding this comment.
Pull request overview
This PR adds a new allLayers option to the outputToCssLayers configuration, allowing users to output all defined CSS layer names in the @layer declaration, even if some layers don't contain any actual CSS rules. This is useful for establishing the complete layer cascade order upfront in CSS.
Changes:
- Added
allLayersboolean option toOutputCssLayersOptionsinterface - Refactored layer sorting logic into a reusable
sortLayersfunction - Modified
getLayersto output all layers fromconfig.layerswhenallLayersis true
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages-engine/core/src/types.ts | Added allLayers option type definition and JSDoc documentation |
| packages-engine/core/src/generator.ts | Implemented allLayers logic by refactoring layer sorting and conditionally using all config layers |
| packages-engine/core/test/use-css-layer.test.ts | Added comprehensive test case for the new allLayers feature |
| packages-engine/core/test/snapshots/use-css-layer.test.ts.snap | Added snapshot showing expected output with all layers declared |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot What do you think of the name of this new option? Do you have any suggestions? |
close #5042