Is there some kind of special syntax I need to use to override Clean CSS defaults when using Grunt CSS min?
Looking at the docs I can successfully get the "roundingPrecision" example working but trying to override other Clean CSS rules does not work for me.
I've given a config example below where I'm trying to prevent duplicate rules being removed (in this case I need a non-css variable fallback for browsers that do not support CSS variables). This is not working for me though.
Here is the CSS Min part of my Grunt config:
cssmin: {
options: {
removeDuplicateRules: false,
roundingPrecision: -1
},
prod: {
files: [{
expand: true,
ext: '.min.css',
src: ['<%= cssPath %>style.css'],
}]
},
},
With the above config, this is what happens:
.test {
background: red;
background: var(--colour-blue);
}
Becomes
.test{background:var(--colour-blue);}
However, the second background rule should not be removed.
I've noticed in a another StackOverflow question it seems like I may need to target some specific area of Clean CSS—Use clean-css compatibility options in grunt-contrib-cssmin—but I'm not sure how to do that for other properties like "removeDuplicateRules: false".
I'm guessing that I'm doing something fundamentally wrong. Any pointers would be helpful—thanks.
Update #2
As suggested I've tried to use the attempted "level" options as follows, without any success:
cssmin: {
options: {
level: {
1: {
all: false
},
2: {
all: false
}
}
},
prod: {
files: [{
expand: true,
ext: '.min.css',
src: ['<%= cssPath %>style.css'],
}]
},
},