Skip to content

Comments

refactor: simplify CSS rules and identifiers#7060

Merged
chenjiahan merged 1 commit intomainfrom
css_rules_0127
Jan 27, 2026
Merged

refactor: simplify CSS rules and identifiers#7060
chenjiahan merged 1 commit intomainfrom
css_rules_0127

Conversation

@chenjiahan
Copy link
Member

Summary

  • Removed the explicit .type('javascript/auto') setting from CSS rule definitions, as it is no longer necessary for correct loader behavior. See feat!: enable css by default rspack#12744.
  • Standardized the rule IDs for CSS, LESS, and SASS by removing the -main suffix to be consistent with Rsbuild v1.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings January 27, 2026 02:39
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @chenjiahan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on refining and standardizing the internal configuration of CSS-related rules and identifiers across the core and various styling plugins. The changes aim to streamline the codebase by eliminating redundant explicit type declarations for CSS rules and enhancing consistency in rule naming conventions. These improvements contribute to a cleaner, more maintainable configuration system, aligning with recent loader advancements and Rsbuild v1 standards.

Highlights

  • CSS Rule Simplification: Removed the explicit .type('javascript/auto') setting from CSS rule definitions, as it is no longer necessary due to updated loader behavior.
  • Standardized Rule Identifiers: Standardized internal rule IDs for CSS, LESS, SASS, and Stylus by removing the -main suffix, ensuring consistency with Rsbuild v1.
  • Side Effects Configuration: Simplified the sideEffects property configuration within the Less, Sass, and Stylus plugins by explicitly setting it to true.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request simplifies CSS rule definitions and standardizes identifiers, which is a positive step towards consistency. The removal of .type('javascript/auto') is a good cleanup. However, I've identified a potential regression in plugin-less, plugin-sass, and plugin-stylus where sideEffects is hardcoded to true. This makes the plugins more brittle, as they were previously inheriting this value dynamically. I've left comments with suggestions to revert these changes to maintain better decoupling and prevent potential future issues. The rest of the changes look good.

@cloudflare-workers-and-pages
Copy link

Deploying rsbuild with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9ade292
Status: ✅  Deploy successful!
Preview URL: https://1af6d87a.rsbuild-v2.pages.dev
Branch Preview URL: https://css-rules-0127.rsbuild-v2.pages.dev

View logs

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors CSS-related webpack chain configurations by simplifying rule identifiers and removing unnecessary type specifications.

Changes:

  • Removed explicit .type('javascript/auto') settings from CSS rule definitions (no longer required per rspack/pull/12744)
  • Standardized rule IDs by removing -main suffix (e.g., css-maincss, sass-mainsass) to align with Rsbuild v1 conventions
  • Updated test snapshots to reflect the removal of type: "javascript/auto" from CSS rule configurations

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/core/src/configChain.ts Updated CHAIN_ID constants to remove -main suffix from CSS_MAIN and JS_MAIN identifiers
packages/core/src/plugins/css.ts Removed .type('javascript/auto') calls from CSS inline and main rule definitions
packages/plugin-stylus/src/index.ts Updated Stylus plugin to use simplified rule IDs, fixed startsWith() check, hardcoded sideEffects to true, and simplified v1 compatibility code
packages/plugin-sass/src/index.ts Updated Sass plugin to use simplified rule IDs, fixed startsWith() check, hardcoded sideEffects to true, and simplified v1 compatibility code
packages/plugin-less/src/index.ts Updated Less plugin to use simplified rule IDs, fixed startsWith() check, hardcoded sideEffects to true, and simplified v1 compatibility code
packages/core/tests/snapshots/*.snap Updated test snapshots to remove "type": "javascript/auto" entries from CSS rule configurations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chenjiahan chenjiahan merged commit 90be475 into main Jan 27, 2026
13 checks passed
@chenjiahan chenjiahan deleted the css_rules_0127 branch January 27, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant