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

BUG: Incorrect statement on @import page - nested section #1040

Closed
dkjain opened this issue May 4, 2024 · 0 comments · Fixed by #1048 or #1053
Closed

BUG: Incorrect statement on @import page - nested section #1040

dkjain opened this issue May 4, 2024 · 0 comments · Fixed by #1048 or #1053

Comments

@dkjain
Copy link

dkjain commented May 4, 2024

Hy,

In my local testing, the following statement turns out to be incorrect in the nested section of @import page.

Note that top-level mixins, functions, and variables defined in the nested import are still defined globally,

I tested by trying to access variable ($primary) defined inside the imported stylesheet (lib/_colors.scss), outside of the nested @import rule and bang, got compile error.

/* Error: Undefined variable.
 *   ,
 * 9 |     color: $primary;
 *   |            ^^^^^^^^
 *   '
 *   style.scss 9:9  root stylesheet */

style.scss

/* Main styles*/
.box {
	display: block;
	@import "lib/_colors";
}

//$primary defined in lib/_colors
.is-primary {
	color: $primary;
}

Colors.scss (lib/_colors.scss)

$black: #000 !default;
$primary: #0a0a0a !default;
$secondary: #d4d4d4;

$border-radius: 0.25rem !default;
$box-shadow: 0 0.5rem 1rem rgba($black, 0.15) !default;

code {
  border-radius: $border-radius;
  box-shadow: $box-shadow;
  color: $primary;
}

However, $primary is available inside the nested context. Thus the statement seems to me, incorrect. Please LMK if I am missing anything.

...top-level mixins, functions, and variables defined in the nested import are still defined globally,

This works

.box {
	display: block;
	@import "lib/_colors";
         color: $primary;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant