Disable all compacting? #731

Closed
corysimmons opened this Issue Feb 7, 2016 · 8 comments

Projects

None yet

2 participants

@corysimmons

Is there any way to disable all compacting? I really just want same-selector merging and nothing else. :(

image

^ doesn't make for a very readable source.

@jakubpawlowicz
Owner

There is no way, see: https://github.com/jakubpawlowicz/clean-css/blob/master/lib/selectors/advanced.js#L59

The reason is minified source is not really for reading it.

@corysimmons

I know minified source isn't for reading. I see clean css more as the only tool out there that can merge the same selectors, so that's what I use it for.

I've made a workaround with concat'ing and stuff, but it'd be nice if I didn't have to have that separate step.

Ah well.

@corysimmons corysimmons closed this Feb 7, 2016
@corysimmons

Care if we re-open this as a feature request? Running into this problem again where I want to use cleancss to merge rules but nothing else.

@jakubpawlowicz
Owner

Sure, no problem.

@corysimmons

Thanks 👍

@jakubpawlowicz jakubpawlowicz modified the milestone: 4.0 Dec 12, 2016
@jakubpawlowicz jakubpawlowicz added a commit that referenced this issue Jan 9, 2017
@jakubpawlowicz See #731 - adds granular control over level 2 optimizations.
Why:

* So users can selectively disable certain optimizations if they wish to.
7d0589c
@jakubpawlowicz jakubpawlowicz added a commit that referenced this issue Jan 10, 2017
@jakubpawlowicz See #731 - adds granular control over level 2 optimizations.
Why:

* So users can selectively disable certain optimizations if they
  want to.
0b81de2
@jakubpawlowicz
Owner
jakubpawlowicz commented Jan 10, 2017 edited

@corysimmons you can do it in master (and soon 4.0) with:

cleancss -O2 all:off;duplicateRulesRemoving:on ...
new CleanCSS({ level: { 2: { all: false; duplicateRulesRemoving: true } } }).minify(...)

EDIT: duplicateRulesRemoving in now called removeDuplicateRules following #853.

@corysimmons

Awesome work. Is this available on the CLI?

@jakubpawlowicz
Owner

Assuming you use master (4.0 soon-ish) you can use it via CLI now:

cleancss -O1 all:false -O2 all:false,removeDuplicateRules:on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment