Skip to content

fix(compiler): preserve library CSS variable names - #70477

Closed
splincode wants to merge 1 commit into
angular:mainfrom
splincode:splincode/fix-css-var-namespacing-libraries
Closed

splincode wants to merge 1 commit into
angular:mainfrom
splincode:splincode/fix-css-var-namespacing-libraries

Conversation

@splincode

@splincode splincode commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

The partial linker runs component styles through CSS variable namespacing while compiling a consuming application. As a result, public CSS variables in third-party library styles receive the application namespace and no longer match global theme variables.

Issue Number: Fixes #70064

What is the new behavior?

Partial component styles preserve ordinary CSS variable names when they are linked, including the JIT declaration path. The linker still removes the --global-- opt-out prefix so partial declarations retain its existing normalization semantics. Full compilation remains unchanged and continues to emit %NS% placeholders for application component styles.

Regression coverage verifies the partial linker output, JIT declarations, the CSS transformation helper, and distinct full-versus-linked compliance output.

Does this PR introduce a breaking change?

  • Yes
  • No

@pullapprove
pullapprove Bot requested review from JeanMeche and JoostK August 30, 2026 17:36
@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Aug 30, 2026
@ngbot ngbot Bot added this to the Backlog milestone Aug 30, 2026
Partial component declarations are linked in the consuming application and must not have their CSS variable names rewritten with the application's namespace. Disable namespace placeholder insertion for partial linker and JIT declaration compilation while retaining global prefix normalization.

Fixes angular#70064
@splincode
splincode force-pushed the splincode/fix-css-var-namespacing-libraries branch from c889128 to d8a6de2 Compare September 17, 2026 19:08
@JeanMeche
JeanMeche requested review from mattrbeck and removed request for JoostK September 20, 2026 17:52
@JeanMeche

Copy link
Copy Markdown
Member

I don't think that unconditionnaly remove the scoping is the right solution here.
Let's discuss the problem directly in the issue.

@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Oct 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: compiler Issues related to `ngc`, Angular's template compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

provideCssVarNamespacing() breaks styling of third-party libraries themed by global CSS variables

2 participants