Skip to content
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

css calc height fallback for older browsers #591

Closed
Ghostavio opened this issue Jun 2, 2015 · 5 comments
Closed

css calc height fallback for older browsers #591

Ghostavio opened this issue Jun 2, 2015 · 5 comments

Comments

@Ghostavio
Copy link

Hello, so I'm using the following in my code:

height: 100%;
height: calc(100% - 55px);

So for browsers without calc support, the first value should be taken, but cssmin is removing it and keeping just height: calc(100% - 55px);, there's anyway to keep this particular duplicated css attribute without disabling all the duplication removal, or maybe creating a rule for this specific case?
In case it's not possible, how would I completely disable the check for duplication?

Thanks.

@jakubpawlowicz
Copy link
Collaborator

Could you share your cssmin setup? I can clearly see it works fine in any 3.x:

> echo "a{height:100%;height:calc(100% - 55px)}" | ./bin/cleancss
a{height:100%;height:calc(100% - 55px)}

@jakubpawlowicz
Copy link
Collaborator

I'll close it for now, but please reopen if needed.

@ahmedelgabri
Copy link

@jakubpawlowicz I have the same exact issue and here is how you can reproduce the problem.

This looks fine

 $ echo ".foo { display: block; display: flex; color: green; align-items: center; }" | ./node_modules/.bin/cleancss
.foo{display:block;display:flex;color:green;align-items:center}

This is not, I moved color between the two display declarations

$ echo ".foo { display: block; color: green; display: flex; align-items: center; }" | ./node_modules/.bin/cleancss
.foo{color:green;display:flex;align-items:center}

It's very subtle but developers will expect their code to work the same in both situations. For now advanced: false fixes this but I think that this behaviour should be normalized. Not sure how since it's a very hard problem to determine when it's a fallback and when it's a duplicated declaration.

@jakubpawlowicz
Copy link
Collaborator

@ahmedelgabri you can also use aggressiveMerging: false for the same effect. Solving this is dependent on #290.

@ahmedelgabri
Copy link

Thanks @jakubpawlowicz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants