* Fixed issue [#226](https://github.com/GoalSmashers/clean-css/issues/226) - don't minify border:none to border:0.
* Fixed issue [#229](https://github.com/GoalSmashers/clean-css/issues/229) - improved processing of fraction numbers.
* Fixed issue [#230](https://github.com/GoalSmashers/clean-css/issues/230) - better handling of zero values.
+* Fixed issue [#235](https://github.com/GoalSmashers/clean-css/issues/235) - IE7 compatibility mode.
* Fixed issue [#236](https://github.com/GoalSmashers/clean-css/issues/236) - incorrect rebasing with nested `import`s.
[2.0.8 / 2014-02-07](https://github.com/GoalSmashers/clean-css/compare/v2.0.7...v2.0.8)
--skip-advanced Disable advanced optimizations - selector & property merging,
reduction, etc.
--selectors-merge-mode [ie8|*] DEPRECATED: Use --compatibility switch
--c, --compatibility [ie8] Force compatibility mode
+-c, --compatibility [ie7|ie8] Force compatibility mode
-d, --debug Shows debug information (minification time & compression efficiency)
```
1. Fork it.
2. Add test(s) veryfying the problem.
3. Fix the problem.
-4. Make sure all tests still pass (`npm test`).
+4. Make sure all tests still pass (`npm test`).
5. Make sure your code doesn't break style rules (`npm run check`).
6. Send a PR.
.option('--skip-rebase', 'Disable URLs rebasing')
.option('--skip-advanced', 'Disable advanced optimizations - selector & property merging, reduction, etc.')
.option('--selectors-merge-mode [ie8|*]', 'DEPRECATED: Use --compatibility switch')
- .option('-c, --compatibility [ie8]', 'Force compatibility mode')
+ .option('-c, --compatibility [ie7|ie8]', 'Force compatibility mode')
.option('-t, --timeout [seconds]', 'Per connection timeout when fetching remote @imports (defaults to 5 seconds)')
.option('-d, --debug', 'Shows debug information (minification time & compression efficiency)');
// zero + unit to zero
var units = ['px', 'em', 'ex', 'cm', 'mm', 'in', 'pt', 'pc', '%'];
- if ('ie8' != options.compatibility)
+ if (['ie7', 'ie8'].indexOf(options.compatibility) == -1)
units.push('rem');
replace(new RegExp('(\\s|:|,)\\-?0(?:' + units.join('|') + ')', 'g'), '$1' + '0');
replace(/\}/g, '}' + lineBreak);
} else {
replace(function optimizeSelectors() {
+ var mergeMode = ['ie7', 'ie8'].indexOf(options.compatibility) > -1 ?
+ options.compatibility :
+ '*';
data = new SelectorsOptimizer(data, context, {
keepBreaks: options.keepBreaks,
lineBreak: lineBreak,
- selectorsMergeMode: options.compatibility == 'ie8' ? 'ie8' : '*'
+ selectorsMergeMode: mergeMode
}).process();
});
}
module.exports = function Optimizer(data, context, options) {
var specialSelectors = {
'*': /\-(moz|ms|o|webkit)\-/,
- 'ie8': /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:not|:target|:visited|:empty|:first\-of|:last|:nth|:only|:root)/
+ 'ie8': /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:not|:target|:visited|:empty|:first\-of|:last|:nth|:only|:root)/,
+ 'ie7': /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:not|:target|:visited|:empty|:first\-of|:last|:nth|:only|:root|:after|:before|:focus)/
};
var minificationsMade = [];
'of supported and unsupported selector': '.one:first-child{color:red}.two:last-child{color:red}',
'of two unsupported selectors': '.one:nth-child(5){color:red}.two:last-child{color:red}'
}, { compatibility: 'ie8' }),
+ 'same bodies - IE7 compat': cssContext({
+ 'of two supported selectors': [
+ '.one{color:red}.two>.three{color:red}',
+ '.one,.two>.three{color:red}'
+ ],
+ 'of supported and unsupported selector': '.one{color:red}.two:last-child{color:red}',
+ 'of two unsupported selectors': '.one:before{color:red}.two:last-child{color:red}'
+ }, { compatibility: 'ie7' }),
'redefined more granular properties': redefineContext({
'animation-delay': ['animation'],
'animation-direction': ['animation'],