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

Fail restructuring similar blocks #196

Open
silentroach opened this issue Mar 30, 2014 · 11 comments
Open

Fail restructuring similar blocks #196

silentroach opened this issue Mar 30, 2014 · 11 comments

Comments

@silentroach
Copy link
Contributor

Input:

.support-question .closed {
    background: url('/s/a/i/ic/util.gif') no-repeat transparent top right;
    background-position: right -65px;
    white-space: nowrap;
    padding-right: 15px;
}
.support-question .opened {
    background: url('/s/a/i/ic/util.gif') no-repeat transparent top right;
    background-position: right -450px;
    white-space: nowrap;
    padding-right: 15px;
}

After CSSO:

.support-question .closed {
    background-position:right -65px
}
.support-question .closed, .support-question .opened {
    background:url('/s/a/i/ic/util.gif') no-repeat top right;
    white-space:nowrap;
    padding-right:15px
}
.support-question .opened {
    background-position:right -450px
}

Position for closed is overriden with default values :{

@silentroach
Copy link
Contributor Author

Something like this:

.pages {
    background-size: cover;
}
#slide-01 {
    background: url(lalala.png) no-repeat;
    background-size: cover;
}

output:

.pages, #slide-01{
    background-size:cover
}

#slide-01{
    background:url(lalala.png) no-repeat
}

background-size is overriden with default value

@silentroach
Copy link
Contributor Author

Bye, csso

@magnars
Copy link

magnars commented Dec 5, 2014

@silentroach What are you using instead? This project looks quite dead.

@tadatuta
Copy link
Member

tadatuta commented Dec 5, 2014

@magnars that's true :(
suggest to switch to https://github.com/jakubpawlowicz/clean-css

@silentroach
Copy link
Contributor Author

Very sad, csso idea is great

@tadatuta
Copy link
Member

tadatuta commented Dec 6, 2014

@silentroach yeah, but nowadays structural optimisations are quite common idea

@silentroach
Copy link
Contributor Author

new hope!

@lahmatiy
Copy link
Member

It's similar to #143, but examples could be useful for tests.

@lahmatiy
Copy link
Member

Current output for first example:

.support-question .closed,.support-question .opened {
    background: url('/s/a/i/ic/util.gif') no-repeat top right;
    white-space: nowrap;
    padding-right: 15px
}

.support-question .closed {
    background-position: right -65px
}

.support-question .opened {
    background-position: right -450px
}

It's correct. But because of good enough declaration positions.
Second example is still fail...

@ArturAralin
Copy link
Contributor

What about second example, it's even possible without context?
How csso can know which block is encapsulates other?

@lahmatiy
Copy link
Member

@ArturAralin what context your talking about? All we need is knowledge about shorthand properties and others (I call it property family) to make proper merge. If you're interesting in problem here is the branch where I started work on this problem (unfinished yet).

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

5 participants