Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(themes): Document/Improve identifying first duplicated definition #28698

Open
jsoref opened this issue Mar 7, 2024 · 0 comments
Open

feat(themes): Document/Improve identifying first duplicated definition #28698

jsoref opened this issue Mar 7, 2024 · 0 comments
Labels
area: many Area label for issues related to many components area: theming P4 A relatively minor issue that is not relevant to core functions

Comments

@jsoref
Copy link

jsoref commented Mar 7, 2024

Feature Description

https://github.com/angular/components/blob/main/guides/duplicate-theming-styles.md talks about duplicate theming styles, and it's referenced by the build system...

That's great, except it only tells users about the second instance of a definition.

If at all possible, it'd be great if there was either tooling or documentation to help users find the first instance of a definition

Use Case

We had some buggy theming code of the form:

style.scss:

@import "themes";
@import "extra-themes";

themes.scss:

@use '@angular/material' as mat;
@import "extra-themes";

$light-theme: mat.define-light-theme((color: ...));
$dark-theme: mat.define-dark-theme((color: ...));

@include mat.all-component-themes($light-theme);

.dark-theme {
  // This mixin only generates the color styles now.
  @include mat.all-component-colors($dark-theme);
}

extra-themes.scss

@use "@angular/material" as mat;
@import "themes";

@mixin extra-themes($theme) {
   ...
}

@include extra-themes($light-theme);

.dark-theme {
  @include extra-colors($dark-theme);
}

Unfortunately, all of the output about duplication appeared like this:

node_modules/@angular/material/core/theming/_theming.scss 352:7          private-check-duplicate-theme-styles()
node_modules/@angular/material/legacy-core/theming/_all-theme.scss 43:3  all-legacy-component-themes()
node_modules/@angular/material/legacy-core/color/_all-color.scss 17:3    all-legacy-component-colors()
@jsoref jsoref added feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team labels Mar 7, 2024
@amysorto amysorto added P4 A relatively minor issue that is not relevant to core functions area: many Area label for issues related to many components area: theming and removed needs triage This issue needs to be triaged by the team feature This issue represents a new feature or feature request rather than a bug or bug fix labels Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: many Area label for issues related to many components area: theming P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

No branches or pull requests

2 participants