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 minify script issue with removing empty {} #23

Closed
somatonic opened this issue Aug 26, 2014 · 6 comments
Closed

css minify script issue with removing empty {} #23

somatonic opened this issue Aug 26, 2014 · 6 comments

Comments

@somatonic
Copy link

In the CSSMin php
// ------------------------------------------------------------------------
// Remove empty blocks.
// ------------------------------------------------------------------------
// $_source = preg_replace('/}[^\/}]+{}/', '}', $_source);

I had to comment out because I like to have some media query in some css empty while developing. The removing of the empty brackets lead to unexpected results with "open" media queries.

@marvinscharle
Copy link
Collaborator

Hi soma,

in my opinion, empty brackets should be removed. How did the empty brackets influence your code?

If they were removed incompletely, this could be a serious bug. Did this happen again?

Thank you in advance!

@somatonic
Copy link
Author

I reviewed this and can't remember what exactly the case was...

But I managed to get a faulty replacement like the "}" but only if there's a rule before it and in the media query a empty rule

.text{
    color: #fff;
}

@media only screen and (min-width: 200px) {
    .text {
    }
}

This gives me

.text{color: #fff}}

This

.text{
}
@media only screen and (min-width: 200px) {
    .text{
    }
    .text2{
    }
}

gives me

.text{}.text2{}}

So it would be nice to have a fix for this cases

@marvinscharle
Copy link
Collaborator

This is related to our intension to switch to a third-party CSS compressor (#34). I think, the problem will be solved automatically.

@hwmaier
Copy link
Contributor

hwmaier commented Feb 9, 2015

I just tested the two cases which somatonic reported and the new YUI CSS compressor handles those correctly. The first case results in

.text{color:#fff}

The second case results in no output as the resulting style is empty.

@marvinscharle marvinscharle mentioned this issue Feb 9, 2015
@marvinscharle
Copy link
Collaborator

Soma, can you please verify if the current version of AIOM (3.2) fixes this issue?

@marvinscharle
Copy link
Collaborator

Sorry - I read over the answer of @hwmaier. In this case, I think this issue is solved. @somatonic: If the problem still occurs, feel free to reopen this issue.

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

No branches or pull requests

3 participants