-
-
Notifications
You must be signed in to change notification settings - Fork 601
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
Hashing on css variables #1241
Comments
Sorry, it is unsafe, css variables is hoisted, can be used in JS or in other CSS files, even inside |
I think this very reason applies to class names?
It's also about modularization of individual CSS files to avoid sharing a global namespace, isn't it? |
class names are not hoisted
As I said before it is unsafe (but we can't rename them in JS or HTML) and maybe better to solve this on minimizing step But we can implement this |
What do you mean by "hoisted"?
If it can be imported into js just like class names, this shouldn't be a problem I suppose? |
https://davidwalsh.name/css-variables-javascript
You still can use variales in HTML and JS or in other CSS files (which can be not part of webpack bundling) |
How is that different from class names? You can still use class names outside webpack building as well I think? What makes CSS variables more unsafe?
What is the problem here? There are lots of CSSOM functions which can take class names as well. I still don't quite see the difference. |
paint worklets will be broken too PR welcome, because it is unsafe (more unsafe than class names), I mark it as lower priority |
Feature Proposal
css variable: https://developer.mozilla.org/en-US/docs/Web/CSS/var
There are cases where we want to use the css variable instead of the
@value
for the responsive design.Say assume I have
I would like to have some variable to synchronize some property between
child
andparent
and this variable is designed to be responsive so@value
can not be used here.Instead of overwrite each rule in
@media
, I would like to do something like: https://jsfiddle.net/g86efhas/2/The problem is the css variable may leads to some name clash.
So is that possible to add the hash to css variable as well
Feature Use Case
Use css-variables and forget about name clashing.
css(--var)
->css(--src-pages-foo-bar-var)
The text was updated successfully, but these errors were encountered: