cssshrink icon indicating copy to clipboard operation
cssshrink copied to clipboard

Why only adjacent selectors / MQ ?

Open raphaelgoetter opened this issue 11 years ago • 1 comments

Hello,

I wonder why only the adjacent selectors / Media Queries / keyframes are packed.

Would it be possible to add an option (a checkbox labelled "great power / great responsibility") which allows packing of non-adjacent stuff ?

raphaelgoetter avatar Nov 17 '14 20:11 raphaelgoetter

I was wondering the same thing - I noticed that this input:

.a .b {
    padding-right: 10px;
}

.a .b .c {
    position: absolute;
}

.a .b {
    padding-bottom: 10px;
}

has the following output:

.a .b {
  padding-right: 10px;
}

.a .b .c {
  position: absolute;
}

.a .b {
  padding-bottom: 10px;
}

when it's possible to see that the top and bottom selectors could be combined.

Is it done this way because there's no way to guarantee the precedence is maintained otherwise?

macgyver avatar Jul 02 '15 22:07 macgyver