Open
Description
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);
}