Deprecates '--selectors-merge-mode' in favor of a more generic '--compatibility'...
authorGoalSmashers <jakub@goalsmashers.com>
Wed, 11 Dec 2013 17:48:45 +0000 (18:48 +0100)
committerGoalSmashers <jakub@goalsmashers.com>
Wed, 11 Dec 2013 18:20:49 +0000 (19:20 +0100)
* 'selectorsMergeMode' option to library is also renamed to 'compatibility'.

History.md
README.md
bin/cleancss
lib/clean.js
test/unit-test.js

index 415c069..2933e80 100644 (file)
@@ -1,6 +1,7 @@
 [2.1.0 / 2013-xx-xx (UNRELEASED)](https://github.com/GoalSmashers/clean-css/compare/v2.0.0...HEAD)
 ==================
 
+* Deprecates --selectors-merge-mode / selectorsMergeMode in favor to --compatibility / compatibility.
 * Skips empty removal if advanced processing is enabled.
 * Fixed issue [#160](https://github.com/GoalSmashers/clean-css/issues/160) - re-runs optimizer until a clean pass.
 * Fixed issue [#161](https://github.com/GoalSmashers/clean-css/issues/161) - improves tokenizer performance.
index c5d8bb9..b022143 100644 (file)
--- a/README.md
+++ b/README.md
@@ -71,7 +71,8 @@ cleancss [options] <source-file>
 --skip-rebase                   Disable URLs rebasing
 --skip-advanced                 Disable advanced optimizations - selector & property merging,
                                 reduction, etc.
---selectors-merge-mode [ie8|*]  Use `ie8` for compatibility mode, `*` for merge all (default)
+--selectors-merge-mode [ie8|*]  DEPRECATED: Use --compatibility switch
+-c, --compatibility [ie8]       Force compatibility mode
 -d, --debug                     Shows debug information (minification time & compression efficiency)
 ```
 
index 0db1805..6fe291c 100755 (executable)
@@ -26,7 +26,8 @@ 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|*]', 'Use `ie8` for compatibility mode, `*` for merge all (default).')
+  .option('--selectors-merge-mode [ie8|*]', 'DEPRECATED: Use --compatibility switch')
+  .option('-c, --compatibility [ie8]', 'Force compatibility mode')
   .option('-d, --debug', 'Shows debug information (minification time & compression efficiency)');
 
 commands.on('--help', function() {
@@ -75,8 +76,12 @@ if (commands.skipRebase)
   cleanOptions.noRebase = true;
 if (commands.skipAdvanced)
   cleanOptions.noAdvanced = true;
-if (commands.selectorsMergeMode)
-  cleanOptions.selectorsMergeMode = commands.selectorsMergeMode;
+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.args.length > 0) {
index 385f6e0..6ea60f1 100644 (file)
@@ -35,6 +35,11 @@ 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 = {
@@ -282,7 +287,7 @@ CleanCSS.prototype.minify = function(data) {
       data = new SelectorsOptimizer(data, context, {
         keepBreaks: options.keepBreaks,
         lineBreak: lineBreak,
-        selectorsMergeMode: options.selectorsMergeMode
+        selectorsMergeMode: options.compatibility == 'ie8' ? 'ie8' : '*'
       }).process();
     });
   }
index 6825376..59f7e44 100644 (file)
@@ -1321,7 +1321,7 @@ title']{display:block}",
     ],
     '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}'
-  }, { selectorsMergeMode: 'ie8' }),
+  }, { compatibility: 'ie8' }),
   'redefined more granular properties': redefineContext({
     'animation-delay': ['animation'],
     'animation-direction': ['animation'],