8000 Configuration for private variables of modules · Issue #4034 · sass/sass · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Configuration for private variables of modules #4034

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

Open
1 of 5 tasks
stof opened this issue Feb 17, 2025 · 2 comments
Open
1 of 5 tasks

Configuration for private variables of modules #4034

stof opened this issue Feb 17, 2025 · 2 comments
Assignees
Labels
bug Something isn't working requires deprecation Blocked on a deprecation cycle

Comments

@stof
Copy link
Contributor
stof commented Feb 17, 2025

While reviewing a PR from a colleague, I discovered that configuring a private variable of a module works, which quite surprised me (I first wanted to post review comments saying this was broken, but our CI proved me wrong as it managed to build the CSS).

// _a.scss
$_separator-size: 8px !default;

a {
  gap: $_separator-size;
}
// input.scss
@use "a" with { $_separator-size: 16px; }

Looking at sass-spec, this is not covered by any tests, so I'm not sure it is intended to allow private members to be configurable. If it is intended, I would suggest adding tests in sass-spec (I could contribute them btw). Otherwise, this might deserve a deprecation.

Solution

Phase 1

Phase 2

  • Trigger an error in dart-sass
@stof
Copy link
Contributor Author
stof commented Feb 17, 2025

Btw, regarding #3171, this feature might even be useful as it means that those private members can be configured but cannot be written later.

@nex3
Copy link
Contributor
nex3 commented Feb 18, 2025

I think this should be an error, since it violates the principle that within a module $-foo is a strictly local identifier. We should deprecate both passing it and declaring !default on a private variable name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working requires deprecation Blocked on a deprecation cycle
Projects
None yet
Development

No branches or pull requests

3 participants
0