feat(core): add allLayers option to output all layer names#5057
Merged
Conversation
✅ Deploy Preview for unocss ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
commit: |
Contributor
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.
Member
Author
|
@copilot What do you think of the name of this new option? Do you have any suggestions? |
Contributor
This was referenced Jan 14, 2026
This was referenced Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #5042