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

Structural optimization bug: wrong place for merged blocks #213

Open
vindm opened this issue Oct 20, 2014 · 3 comments
Open

Structural optimization bug: wrong place for merged blocks #213

vindm opened this issue Oct 20, 2014 · 3 comments

Comments

@vindm
Copy link

vindm commented Oct 20, 2014

File test.css:
.footer__teaser-image_type_i-phone
{
background: url(a.png);
background-image: url(../../../sprites/c.png);
background-repeat: no-repeat;
background-position: -102px -74px;
}
.footer__teaser-image_type_logo
{
background: url(b.png);
background-image: url(../../../sprites/c.png);
background-repeat: no-repeat;
background-position: -2px -146px;
}

Run csso: csso test.css _test.css

File _test.css:
.footer__teaser-image_type_i-phone{background:url(a.png);background-position:-102px -74px}
_.footer__teaser-image_type_i-phone,.footer__teaser-image_type_logo{background-image:url(../../../sprites/c.png);background-repeat:no-repeat}_
.footer__teaser-image_type_logo{background:url(b.png);background-position:-2px -146px}

I expect that common styles rule will be inserted after original ones but not between.

@transitive-bullshit
Copy link

👍 running into this exact issue as well.

@simenbrekken
Copy link

Declarations are being dropped for me as well:

.brand, 
.name, 
.description {
    margin: 0 auto;
    padding: 0 20px;
    max-width: 360px
}

.brand, 
.name {
    margin-top: 0;
    line-height: 1
}

.brand {
    margin-bottom: 8px;
    font-weight: 900;
    font-size: 1.625em;
    text-transform: uppercase
}

.name {
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 1.125em
}

Becomes:

.brand, 
.name, 
.description {
    padding: 0 20px;
    max-width: 360px
}

.brand {
    line-height: 1
}

.name {
    margin-top: 0;
    line-height: 1
}

.brand {
    margin: 0 auto 8px;
    font-weight: 900;
    font-size: 1.625em;
    text-transform: uppercase
}

.name {
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 1.125em
}

Notice how the margin: 0 auto declaration has been dropped in the optimized version.

@lahmatiy
Copy link
Member

lahmatiy commented Oct 7, 2015

Duplicates #143

@lahmatiy lahmatiy changed the title Structural optimization bug Structural optimization bug: wrong place for merged blocks Oct 7, 2015
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

4 participants