csso icon indicating copy to clipboard operation
csso copied to clipboard

Structural optimization bug: wrong place for merged blocks

Open vindm opened this issue 11 years ago • 3 comments

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.

vindm avatar Oct 20 '14 13:10 vindm

:+1: running into this exact issue as well.

transitive-bullshit avatar Oct 30 '14 22:10 transitive-bullshit

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.

simenbrekken avatar Nov 05 '14 08:11 simenbrekken

Duplicates #143

lahmatiy avatar Oct 07 '15 21:10 lahmatiy