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
Use important properties for optimalization opportunities #184
Comments
NOTE: I've already implemented this in my fork, just opened the ticket in order to make you aware of this possibility. |
👍 good stuff |
I'm not sure this makes sense code-wise though. The resulting CSS might be smaller, sure, but it's like going forward and then changing direction to go backwards... |
@XhmikosR Sorry, I don't quite get your point |
@XhmikosR I don't get it either - our goal is the smallest CSS possible no matter what, right? |
I guess I was thinking it from a code quality point of view. It's a hack, but it should work, so ignore my previous comment. |
@XhmikosR Did you actually read my code and think it's a hack? If so, I'm open to your suggestions on how to implement it differently. |
I didn't read your code; I read the example above... It's a hack because you set one property to 0 knowing it will be overwritten anyway, that's what I meant. I can't think of any other approach for this specific example, so your way seems to be the best at this point if we want to handle this case. |
@XhmikosR I believe there is no other way. We are fine as long as it renders the same way. |
Yeah. I don't think there would be any issues with any browser. The last property is always used as far as I know. |
Fixed with #249. |
In cases where there are not enough non-important properties for compacting into a shorthand, but there could be when taking important properties into account, we can use them to our advantage.
For example, this code:
is equivalent to the following:
Reasoning:
In the example it is safe to add a fake
0
for non-importantmargin-bottom
andmargin-left
because their values are going to be overridden by the important properties. However, there is a visible gain in terms of CSS size.The text was updated successfully, but these errors were encountered: