-
Notifications
You must be signed in to change notification settings - Fork 446
tip: scoping variables with & { ... } #21
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
Comments
👍 |
👍 The best scoping trick so far |
Yeah, it's pretty clean too. This doesn't feel hacky to me at all. |
+1. I usually call it "unnamed scope" technique. |
It works also with import less/less.js#2442 |
Thanks!!! |
This was referenced Mar 17, 2017
Open
In |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a trick I use to define variables and keep them in some private scope, avoiding them leaking to the global space.
Here,
@height
and@width
are only defined for the scope created by& { ... }
You can also nest an scope inside a rule:
The text was updated successfully, but these errors were encountered: