components icon indicating copy to clipboard operation
components copied to clipboard

bug(theming/migration): `@angular/material/theming` SCSS entrypoint removed in v17

Open benelliott opened this issue 7 months ago • 4 comments

Is this a regression?

  • [X] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

16.2.x

Description

The @angular/material/theming entrypoint is broken in v17.x.

It looks like the src/material/_theming.scss file was deliberately removed as part of https://github.com/angular/components/commit/86e9e524c3234f44eece21632048cd4290e5f3f4#diff-bfa19b8f86d56d399fc0cb86ac55e1b95d161f081beb123cd2bcf31196eae030

However, I can't seem to find any mention of this breaking change in the release notes, nor is the problem automatically fixed by the migration schematic.

Additionally, the entrypoint still appears in the package.json: https://github.com/angular/components/blob/main/src/material/package-base.json#L20

Reproduction

StackBlitz link: Steps to reproduce: 1. 2.

Expected Behavior

Either the entrypoint should still work, or there should be some documentation as to how to migrate away from it.

I was previously using it to import public values such as $light-primary-text for use in my own palettes.

Actual Behavior

The entrypoint no longer works, but still appears in the package.json.

Environment

  • Angular: 17.x
  • CDK/Material: 17.x
  • Browser(s): N/A
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

benelliott avatar Nov 29 '23 16:11 benelliott

Seems to have been moved to @angular/material/core/theming/theming

jkapongo avatar Dec 12 '23 19:12 jkapongo

Seems to have been moved to @angular/material/core/theming/theming

I don't think it's moved. It was already there in v16.

Michel73 avatar Dec 15 '23 09:12 Michel73

I just remove the import , and my theme working well. It`s very strange

Before

@use '@angular/material' as mat;
@import '@angular/material/theming';

After

@use '@angular/material' as mat;

dburgos92 avatar Dec 21 '23 13:12 dburgos92

Using Sass @import for Angular Material has been deprecated for a while (since at least v12 I believe). In v17 we removed CSS that was only there for backwards compatibility with @import. All usages of our Sass should go through @use now.

mmalerba avatar Jan 09 '24 21:01 mmalerba

Hi @mmalerba , the issue occurs regardless (I was using @use).

benelliott avatar Jan 10 '24 10:01 benelliott

@mmalerba Can you reopen this please? It has nothing to do with @use.

benelliott avatar Jan 16 '24 15:01 benelliott

Anyone fixed that problem?

KarolZirex avatar Jan 29 '24 22:01 KarolZirex

Do we have any workaround

dangigrv avatar Feb 01 '24 10:02 dangigrv

The only way I could get an @import to work was make it a relative path, which is horrendous but works. From: @import "src/assets/styles/variables"; To: @import "../../../../assets/styles/variables";

scurtis7 avatar Feb 03 '24 19:02 scurtis7

Using Sass @import for Angular Material has been deprecated for a while (since at least v12 I believe). In v17 we removed CSS that was only there for backwards compatibility with @import. All usages of our Sass should go through @use now.

I'm apply this solution and fix the problem. You should change your main.scss for usage @use instead on @import.

imasip avatar Feb 14 '24 17:02 imasip

any resolution to this issue? same problem here :/

born2net avatar Mar 07 '24 05:03 born2net

This issue 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.

For our @use API, everything can be accessed from the top-level entry point: @use '@angular/material' as mat;. The @angular/material/theming entry point was only exposed to support pre-existing @import statements which were deprecated a long time back

mmalerba avatar Apr 07 '24 17:04 mmalerba