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

Get rid of "default" flag for SASS #1

Closed
iliatcymbal opened this issue Jul 14, 2018 · 3 comments
Closed

Get rid of "default" flag for SASS #1

iliatcymbal opened this issue Jul 14, 2018 · 3 comments

Comments

@iliatcymbal
Copy link

Is it possible to set scss variables without !default directive? It looks bad and bit confusing (css or sass rules don't have "default" rule, it's some unnecessary artifact)

@terence55
Copy link
Owner

When scss files were transformed to css files, variables substitutions would be the nearest variable definition before the selector, but not the last variable definition. That's different from less. So all the generated theme files would have the same content.

original scss:

$content: "First content";
.main {
  content: $content;
}
$content: "Second content";

css:

.main {
  content: "First content";
}

To solve the problem, theme-level variables will be imported before default variables and default variables should be marked with !default.

css or sass rules don't have "default" rule, it's some unnecessary artifact

Actually sass has the default rule, for more details, you can visit the sass documentation.
https://sass-lang.com/documentation/file.SASS_REFERENCE.html#variable_defaults_default

@iliatcymbal
Copy link
Author

Ah, ok, got it. But stiil fill uncomfartable with this !default) Thank you

@terence55
Copy link
Owner

Indeed, it's different from other style formats in sass, only the variables marked with !default can be substituted by individual theme variables in compilation. I also wanna discard it if I can.

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