csso
csso copied to clipboard
Fail restructuring similar blocks
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 :{
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
Bye, csso
@silentroach What are you using instead? This project looks quite dead.
@magnars that's true :( suggest to switch to https://github.com/jakubpawlowicz/clean-css
Very sad, csso idea is great
@silentroach yeah, but nowadays structural optimisations are quite common idea
new hope!
It's similar to #143, but examples could be useful for tests.
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...
What about second example, it's even possible without context? How csso can know which block is encapsulates other?
@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).