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

variable-exists should be migrated as well #270

Open
Krathegon opened this issue Feb 13, 2025 · 0 comments
Open

variable-exists should be migrated as well #270

Krathegon opened this issue Feb 13, 2025 · 0 comments
Assignees

Comments

@Krathegon
Copy link

The migrator changes @import with @use. I'm using the function variable-exists which only checks for variables in the current scope. With @use everything inside this file will be moved to its own namespace, so the check fails.

Example before migration (variable theme is declared nested inside './styles/themes/new/palette/scss'):

@use '@angular/material' as mat;
@import './app/app.theme';
@import './styles/core';
@import './styles/theme';

@if variable-exists(theme) {
  @include mat.all-component-themes($theme);
  @include app-theme(palette.$theme);
}

After migration:

@use '@angular/material' as mat;
@use 'sass:meta';
@use 'app/app.theme';
@use 'styles/core';
@use 'styles/theme';
@use 'styles/themes/new/palette';

@if meta.variable-exists(theme) { // <--- this check fails
  @include mat.all-component-themes(palette.$theme);
  @include app.app-theme(palette.$theme);
}

Expected:

@use '@angular/material' as mat;
@use 'sass:meta';
@use 'app/app.theme';
@use 'styles/core';
@use 'styles/theme';
@use 'styles/themes/new/palette';

@if meta.global-variable-exists(theme, palette) { 
  @include mat.all-component-themes(palette.$theme);
  @include app.app-theme(palette.$theme);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants