refactor(mp-alipay): drop page rules left with comments only - #6074
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The change is small, targeted, and the updated test suite directly verifies the new behavior without introducing observable regressions.
Pull request overview
This PR refines the mp-alipay PostCSS page-background adaptation so that it also removes page { ... } rules that become empty after moving declarations, even if they still contain only comments—preventing leftover “comment-only” rules that no longer serve a purpose.
Changes:
- Add
isRemovableRule()to treat comment-only rules as removable after declarations are moved. - Update the cleanup condition in
createBackgroundRule()to remove rules with no nodes or only comment nodes. - Adjust the unit test to assert the comment-only
pagerule is removed, leaving only the generated:rootrule.
File summaries
| File | Description |
|---|---|
| packages/uni-cli-shared/src/postcss/plugins/alipayPageBackground.ts | Removes original page rules when they are empty or contain only comments after background/CSS var extraction. |
| packages/uni-cli-shared/tests/uniapp.spec.ts | Updates the test expectation to validate removal of comment-only page rules. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Size report
|
After moving CSS variables and background declarations to :root, a page rule containing only comments was kept, leaving an empty rule plus a comment that no longer describes anything in it. Remove such rules as well, while still keeping rules that have remaining declarations or nested rules.
chouchouji
force-pushed
the
fix-alipay-page-background-css-vars
branch
from
September 18, 2026 12:43
ac66295 to
bd75fbb
Compare
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.
After moving CSS variables and background declarations to :root, a page rule containing only comments was kept, leaving an empty rule plus a comment that no longer describes anything in it. Remove such rules as well, while still keeping rules that have remaining declarations or nested rules.