-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Empty values for variables #7121
Comments
Hey! Thank you for your question! This is by design and not a bug. It is a bug in your IDE for incorrectly thinking that it is a bug. These empty values are defaults and we use them in different places. If we don't have them and you use one of those variables then the variable is "undefined" and the css would be broken. We have some utilities that override these values so that they actually do something. For example try to use "rotate-45" and look at the generated css. If you build your css then you should see that everything should work as expected. |
Wasn't it var(--tw-empty) before? --tw-blur: var(--tw-empty,/*!*/ /*!*/);
--tw-brightness: var(--tw-empty,/*!*/ /*!*/);
--tw-contrast: var(--tw-empty,/*!*/ /*!*/);
--tw-grayscale: var(--tw-empty,/*!*/ /*!*/); Phpstorm then treats as a valid value. |
Yep, it was Long story short, |
Hi @RobinMalfait! Thanks a lot for the insight into why it's there. Good to know it's not a bug. Phew. That being said, even if it's not a bug it still is admittedly a hack 😅. On that note, wouldn't using Added benefit of using |
@dolma the When you use a class like .blur {
--tw-blur: blur(8px);
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
} This means that eventually the filter: blur(8px); If we used filter: none; And that's definitely not what you want, you want that blur. It just happens that one of the other values is Having no space at all, like: Before this, our solution was to have this value: --tw-blur: var(--empty, /*!*/ /*!*/); And this was just to prevent bugs in minifiers. Because, if you look closely, you will notice that there is just a space between the 2 comments, that's the behaviour we want. The reason we have The minifier bugs have been fixed for a while now, so we cleaned it up to the actual values we want. Ofcourse ideally we want a value that represents a placeholder for nothingness, but afaik that doesn't exist in css. |
@RobinMalfait Hmm interesting, thanks for the breakdown mate. Yeah it seems like there's really nothing to be done unfortunately. Interestingly it does seem to work for the toggle hack (at least in some cases, probably just by luck) but guess it just doesn't work as a substitute for how the whitespace hack is used in tailwind.
Guess I was right about that one |
bad design patterns |
I would suggest doing it the "valid" way: When we inline our css, https://validator.w3.org/ throws also errors because of this. Why not use
instead of
? Must then |
Cloudflare auto-minification is also affected by the empty values... This below stops Cloudflare from minifying the CSS (Tailwind v3.1.3):
|
W3C themselves mark this as a parse error on https://validator.w3.org/ |
Tailwind version: 3.0.15
Hi. I installed a fresh project on Laravel 8 and after configuring it, I noticed that it is full of empty values. Everything else works as expected.
generated CSS:
My config:
postcss.config.js
tailwind.config.js
webpack.mix.js
app.css
The text was updated successfully, but these errors were encountered: