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;
}
@nex3 nex3 closed this as completed in #1048 May 7, 2024
Friendly-users added a commit to Friendly-users/sass-site that referenced this issue Jun 27, 2024
-----
It is inappropriate to include political and offensive content in public code repositories.

Public code repositories should be neutral spaces for collaboration and community, free from personal or political views that could alienate or discriminate against others. Political content, especially that which targets or disparages minority groups, can be harmful and divisive. It can make people feel unwelcome and unsafe, and it can create a hostile work environment.

Please refrain from adding such content to public code repositories.
---
 sass#1001 sass#1002 sass#1003 sass#1004 sass#1005 sass#1006 sass#1007 sass#1008 sass#1009 sass#1010 sass#1011 sass#1012 sass#1013 sass#1014 sass#1015 sass#1016 sass#1017 sass#1018 sass#1019 sass#1020 sass#1021 #1022 sass#1023 sass#1024 sass#1025 sass#1026 sass#1027 sass#1028 sass#1029 sass#1030 sass#1031 sass#1032 sass#1033 sass#1034 sass#1035 sass#1036 sass#1037 sass#1038 sass#1039 sass#1040 sass#1041 sass#1042 sass#1043 sass#1044 sass#1045 sass#1046 sass#1047 sass#1048 sass#1049 sass#1050
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