Skip to content

Commit

Permalink
Fixes #247 - gets rid of deprecated selectorsMergeMode option.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Pawlowicz committed Feb 25, 2014
1 parent f030e50 commit 4221da1
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 17 deletions.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
==================

* Adds a better non-adjacent optimizer compatible with the upcoming new property optimizer.
* Fixed issue [#247](https://github.com/GoalSmashers/clean-css/issues/247) - removes deprecated `selectorsMergeMode` switch.

[2.1.2 / 2014-02-25](https://github.com/GoalSmashers/clean-css/compare/v2.1.1...v2.1.2)
==================
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ cleancss [options] <source-file>
--skip-rebase Disable URLs rebasing
--skip-advanced Disable advanced optimizations - selector & property merging,
reduction, etc.
--selectors-merge-mode [ie8|*] DEPRECATED: Use --compatibility switch
-c, --compatibility [ie7|ie8] Force compatibility mode
-d, --debug Shows debug information (minification time & compression efficiency)
```
Expand Down Expand Up @@ -129,7 +128,6 @@ CleanCSS constructor accepts a hash as a parameter, i.e.,
* `processImport` - whether to process `@import` rules
* `noRebase` - whether to skip URLs rebasing
* `noAdvanced` - set to true to disable advanced optimizations - selector & property merging, reduction, etc.
* `selectorsMergeMode` - DEPRECATED: Use compatibility option
* `compatibility` - Force compatibility mode to `ie7` or `ie8`. Defaults to not set.
* `debug` - set to true to get minification statistics under `stats` property (see `test/custom-test.js` for examples)

Expand Down
5 changes: 0 additions & 5 deletions bin/cleancss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ commands
.option('-s, --skip-import', 'Disable @import processing')
.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 [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)');
Expand Down Expand Up @@ -79,10 +78,6 @@ if (commands.skipAdvanced)
cleanOptions.noAdvanced = true;
if (commands.compatibility)
cleanOptions.compatibility = commands.compatibility;
if (commands.selectorsMergeMode) {
console.warn('--selectors-merge-mode is deprecated and will be removed in clean-css 2.2. Please use --compatibility %s switch instead.', commands.selectorsMergeMode);
cleanOptions.compatibility = commands.selectorsMergeMode;
}
if (commands.debug)
cleanOptions.debug = true;
if (commands.timeout)
Expand Down
9 changes: 0 additions & 9 deletions lib/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ var CleanCSS = module.exports = function CleanCSS(options) {
if (undefined === options.processImport)
options.processImport = true;

if (options.selectorsMergeMode) {
console.warn('selectorsMergeMode is deprecated and will be removed in clean-css 2.2. Please use compatibility: \'%s\' option instead.', options.selectorsMergeMode);
options.compatibility = options.selectorsMergeMode;
}

this.options = options;
this.stats = {};
this.context = {
Expand Down Expand Up @@ -336,13 +331,9 @@ var minify = function(data, callback) {
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: mergeMode,
compatibility: options.compatibility
}).process();
});
Expand Down
2 changes: 1 addition & 1 deletion lib/selectors/optimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module.exports = function Optimizer(data, context, options) {
};

var isSpecial = function(selector) {
return specialSelectors[options.selectorsMergeMode || '*'].test(selector);
return specialSelectors[options.compatibility || '*'].test(selector);
};

var removeDuplicates = function(tokens) {
Expand Down

0 comments on commit 4221da1

Please sign in to comment.