Fixes #853 - renames level 2 options.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 10 Jan 2017 13:39:51 +0000 (14:39 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 10 Jan 2017 13:50:09 +0000 (14:50 +0100)
Why:

* To match level 1 wording which feels more natural.

26 files changed:
README.md
bin/cleancss
lib/optimizer/level-2/compacting/optimize.js
lib/optimizer/level-2/merge-media-queries.js
lib/optimizer/level-2/merge-non-adjacent-by-body.js
lib/optimizer/level-2/optimize.js
lib/options/optimization-level.js
test/batch-test.js
test/binary-test.js
test/integration-test.js
test/module-test.js
test/optimizer/level-2/compacting/longhand-overriding-test.js
test/optimizer/level-2/compacting/optimize-test.js
test/optimizer/level-2/compacting/override-compacting-test.js
test/optimizer/level-2/compacting/shorthand-compacting-test.js
test/optimizer/level-2/merge-adjacent-test.js
test/optimizer/level-2/merge-media-queries-test.js
test/optimizer/level-2/merge-non-adjacent-by-body-test.js
test/optimizer/level-2/merge-non-adjacent-by-selector-test.js
test/optimizer/level-2/reduce-non-adjacent-test.js
test/optimizer/level-2/remove-duplicate-font-at-rules-test.js
test/optimizer/level-2/remove-duplicate-media-queries-test.js
test/optimizer/level-2/remove-duplicates-test.js
test/optimizer/level-2/restructure-test.js
test/options/optimization-level-test.js
test/source-map-test.js

index 4cfed0d..9b339e6 100644 (file)
--- a/README.md
+++ b/README.md
@@ -146,18 +146,18 @@ Level 2 optimizations:
 
 ```bash
 cleancss -O2 one.css
-cleancss -O2 mediaMerging:off;restructuring:off;semanticMerging:on;shorthandCompacting:off one.css
-cleancss -O2 all:off;duplicateRulesRemoving:on one.css
-# `adjacentRulesMerging` controls adjacent rules merging; defaults to `on`
-# `duplicateFontRulesRemoving` controls duplicate `@font-face` removing; defaults to `on`
-# `duplicateMediaRemoving` controls duplicate `@media` removing; defaults to `on`
-# `duplicateRulesRemoving` controls duplicate rules removing; defaults to `on`
-# `mediaMerging` controls `@media` merging; defaults to `on`
-# `nonAdjacentRulesMerging` controls non-adjacent rule merging; defaults to `on`
-# `nonAdjacentRulesReducing` controls non-adjacent rule reducing; defaults to `on`
-# `restructuring` controls content restructuring; defaults to `off`
-# `semanticMerging` controls semantic merging; defaults to `off`
-# `shorthandCompacting` controls shorthand compacting; defaults to `on`
+cleancss -O2 mergeMedia:off;restructureRules:off;mergeSemantically:on;compactShorthands:off one.css
+cleancss -O2 all:off;removeDuplicateRules:on one.css
+# `compactShorthands` controls shorthand compacting; defaults to `on`
+# `mergeAdjacentRules` controls adjacent rules merging; defaults to `on`
+# `mergeMedia` controls `@media` merging; defaults to `on`
+# `mergeNonAdjacentRules` controls non-adjacent rule merging; defaults to `on`
+# `mergeSemantically` controls semantic merging; defaults to `off`
+# `reduceNonAdjacentRules` controls non-adjacent rule reducing; defaults to `on`
+# `removeDuplicateFontRules` controls duplicate `@font-face` removing; defaults to `on`
+# `removeDuplicateMediaBlocks` controls duplicate `@media` removing; defaults to `on`
+# `removeDuplicateRules` controls duplicate rules removing; defaults to `on`
+# `restructureRules` controls rule restructuring; defaults to `off`
 ```
 
 ### How to use clean-css API?
@@ -234,7 +234,7 @@ new CleanCSS({
 new CleanCSS({
   level: {
     1: {
-      all: false // sets all values to `false`
+      all: false, // sets all values to `false`
       tidySelectors: true // turns on optimizing selectors
     }
   }
@@ -246,16 +246,16 @@ new CleanCSS({
 new CleanCSS({
   level: {
     2: {
-      adjacentRulesMerging: true, // controls adjacent rules merging; defaults to true
-      duplicateFontRulesRemoving: true, // controls duplicate `@font-face` removing; defaults to true
-      duplicateMediaRemoving: true, // controls duplicate `@media` removing; defaults to true
-      duplicateRulesRemoving: true, // controls duplicate rules removing; defaults to true
-      mediaMerging: true, // controls `@media` merging; defaults to true
-      nonAdjacentRulesMerging: true, // controls non-adjacent rule merging; defaults to true
-      nonAdjacentRulesReducing: true, // controls non-adjacent rule reducing; defaults to true
-      restructuring: false, // controls content restructuring; defaults to false
-      semanticMerging: false, // controls semantic merging; defaults to false
-      shorthandCompacting: true, // controls shorthand compacting; defaults to true
+      compactShorthands: true, // controls shorthand compacting; defaults to true
+      mergeAdjacentRules: true, // controls adjacent rules merging; defaults to true
+      mergeMedia: true, // controls `@media` merging; defaults to true
+      mergeNonAdjacentRules: true, // controls non-adjacent rule merging; defaults to true
+      mergeSemantically: false, // controls semantic merging; defaults to false
+      reduceNonAdjacentRules: true, // controls non-adjacent rule reducing; defaults to true
+      removeDuplicateFontRules: true, // controls duplicate `@font-face` removing; defaults to true
+      removeDuplicateMediaBlocks: true, // controls duplicate `@media` removing; defaults to true
+      removeDuplicateRules: true, // controls duplicate rules removing; defaults to true
+      restructureRules: false // controls rule restructuring; defaults to false
     }
   }
 });
@@ -264,8 +264,8 @@ new CleanCSS({
 new CleanCSS({
   level: {
     1: {
-      all: false // sets all values to `false`
-      duplicateRulesRemoving: true // turns on removing duplicate rules
+      all: false, // sets all values to `false`
+      removeDuplicateRules: true // turns on removing duplicate rules
     }
   }
 });
@@ -485,7 +485,7 @@ In library mode you can also pass `compatibility` as a hash of options.
 All level 2 optimizations are dispatched [here](https://github.com/jakubpawlowicz/clean-css/blob/master/lib/selectors/advanced.js#L59), and this is what they do:
 
 * `recursivelyOptimizeBlocks` - does all the following operations on a block (think `@media` or `@keyframe` at-rules);
-* `recursivelyOptimizeProperties` - optimizes properties in rulesets and "flat at-rules" (like @font-face) by splitting them into components (e.g. `margin` into `margin-(*)`), optimizing, and rebuilding them back. You may want to use `shorthandCompacting` option to control whether you want to turn multiple (long-hand) properties into a shorthand ones;
+* `recursivelyOptimizeProperties` - optimizes properties in rulesets and "flat at-rules" (like @font-face) by splitting them into components (e.g. `margin` into `margin-(*)`), optimizing, and rebuilding them back. You may want to use `compactShorthands` option to control whether you want to turn multiple (long-hand) properties into a shorthand ones;
 * `removeDuplicates` - gets rid of duplicate rulesets with exactly the same set of properties (think of including the same Sass / Less partial twice for no good reason);
 * `mergeAdjacent` - merges adjacent rulesets with the same selector or rules;
 * `reduceNonAdjacent` - identifies which properties are overridden in same-selector non-adjacent rulesets, and removes them;
index f613afd..06cd8c2 100755 (executable)
@@ -62,18 +62,18 @@ commands.on('--help', function () {
   console.log('');
   console.log('  Level 2 optimizations:');
   console.log('    %> cleancss -O2 one.css');
-  console.log('    %> cleancss -O2 mediaMerging:off;restructuring:off;semanticMerging:on;shorthandCompacting:off one.css');
-  console.log('    %> cleancss -O2 all:off;duplicateRulesRemoving:on one.css');
-  console.log('    %> # `adjacentRulesMerging` controls adjacent rules merging; defaults to `on`');
-  console.log('    %> # `duplicateFontRulesRemoving` controls duplicate `@font-face` removing; defaults to `on`');
-  console.log('    %> # `duplicateMediaRemoving` controls duplicate `@media` removing; defaults to `on`');
-  console.log('    %> # `duplicateRulesRemoving` controls duplicate rules removing; defaults to `on`');
-  console.log('    %> # `mediaMerging` controls `@media` merging; defaults to `on`');
-  console.log('    %> # `nonAdjacentRulesMerging` controls non-adjacent rule merging; defaults to `on`');
-  console.log('    %> # `nonAdjacentRulesReducing` controls non-adjacent rule reducing; defaults to `on`');
-  console.log('    %> # `restructuring` controls content restructuring; defaults to `off`');
-  console.log('    %> # `semanticMerging` controls semantic merging; defaults to `off`');
-  console.log('    %> # `shorthandCompacting` controls shorthand compacting; defaults to `on`');
+  console.log('    %> cleancss -O2 mergeMedia:off;restructureRules:off;mergeSemantically:on;compactShorthands:off one.css');
+  console.log('    %> cleancss -O2 all:off;removeDuplicateRules:on one.css');
+  console.log('    %> # `compactShorthands` controls shorthand compacting; defaults to `on`');
+  console.log('    %> # `mergeAdjacentRules` controls adjacent rules merging; defaults to `on`');
+  console.log('    %> # `mergeMedia` controls `@media` merging; defaults to `on`');
+  console.log('    %> # `mergeNonAdjacentRules` controls non-adjacent rule merging; defaults to `on`');
+  console.log('    %> # `mergeSemantically` controls semantic merging; defaults to `off`');
+  console.log('    %> # `reduceNonAdjacentRules` controls non-adjacent rule reducing; defaults to `on`');
+  console.log('    %> # `removeDuplicateFontRules` controls duplicate `@font-face` removing; defaults to `on`');
+  console.log('    %> # `removeDuplicateMediaBlocks` controls duplicate `@media` removing; defaults to `on`');
+  console.log('    %> # `removeDuplicateRules` controls duplicate rules removing; defaults to `on`');
+  console.log('    %> # `restructureRules` controls rule restructuring; defaults to `off`');
 
   process.exit();
 });
index 33a7118..687e617 100644 (file)
@@ -210,7 +210,7 @@ function compactorOptimize(selector, properties, mergeAdjacent, withCompacting,
     }
   }
 
-  if (withCompacting && context.options.level[OptimizationLevel.Two].shorthandCompacting) {
+  if (withCompacting && context.options.level[OptimizationLevel.Two].compactShorthands) {
     compactOverrides(_properties, context.options.compatibility, validator);
     compactShorthands(_properties, validator);
   }
index f508876..0698c56 100644 (file)
@@ -8,7 +8,7 @@ var OptimizationLevel = require('../../options/optimization-level').Optimization
 var Token = require('../../tokenizer/token');
 
 function mergeMediaQueries(tokens, context) {
-  var semanticMerging = context.options.level[OptimizationLevel.Two].semanticMerging;
+  var mergeSemantically = context.options.level[OptimizationLevel.Two].mergeSemantically;
   var candidates = {};
   var reduced = [];
 
@@ -52,7 +52,7 @@ function mergeMediaQueries(tokens, context) {
           var traversedProperties = extractProperties(tokens[from]);
           from += delta;
 
-          if (semanticMerging && allSameRulePropertiesCanBeReordered(movedProperties, traversedProperties)) {
+          if (mergeSemantically && allSameRulePropertiesCanBeReordered(movedProperties, traversedProperties)) {
             continue;
           }
 
index ac7046a..5046b04 100644 (file)
@@ -36,7 +36,7 @@ function removeAnyUnsafeElements(left, candidates) {
 
 function mergeNonAdjacentByBody(tokens, context) {
   var options = context.options;
-  var semanticMerging = options.level[OptimizationLevel.Two].semanticMerging;
+  var mergeSemantically = options.level[OptimizationLevel.Two].mergeSemantically;
   var adjacentSpace = options.compatibility.selectors.adjacentSpace;
   var mergeablePseudoClasses = options.compatibility.selectors.mergeablePseudoClasses;
   var mergeablePseudoElements = options.compatibility.selectors.mergeablePseudoElements;
@@ -47,10 +47,10 @@ function mergeNonAdjacentByBody(tokens, context) {
     if (token[0] != Token.RULE)
       continue;
 
-    if (token[2].length > 0 && (!semanticMerging && unsafeSelector(serializeRules(token[1]))))
+    if (token[2].length > 0 && (!mergeSemantically && unsafeSelector(serializeRules(token[1]))))
       candidates = {};
 
-    if (token[2].length > 0 && semanticMerging && isBemElement(token))
+    if (token[2].length > 0 && mergeSemantically && isBemElement(token))
       removeAnyUnsafeElements(token, candidates);
 
     var candidateBody = serializeBody(token[2]);
index 546a759..3dae947 100644 (file)
@@ -72,44 +72,44 @@ function level2Optimize(tokens, context, withRestructuring) {
   recursivelyOptimizeBlocks(tokens, context);
   recursivelyOptimizeProperties(tokens, context);
 
-  if (levelOptions.duplicateRulesRemoving) {
+  if (levelOptions.removeDuplicateRules) {
     removeDuplicates(tokens, context);
   }
 
-  if (levelOptions.adjacentRulesMerging) {
+  if (levelOptions.mergeAdjacentRules) {
     mergeAdjacent(tokens, context);
   }
 
-  if (levelOptions.nonAdjacentRulesReducing) {
+  if (levelOptions.reduceNonAdjacentRules) {
     reduceNonAdjacent(tokens, context);
   }
 
-  if (levelOptions.nonAdjacentRulesMerging && levelOptions.nonAdjacentRulesMerging != 'body') {
+  if (levelOptions.mergeNonAdjacentRules && levelOptions.mergeNonAdjacentRules != 'body') {
     mergeNonAdjacentBySelector(tokens, context);
   }
 
-  if (levelOptions.nonAdjacentRulesMerging && levelOptions.nonAdjacentRulesMerging != 'selector') {
+  if (levelOptions.mergeNonAdjacentRules && levelOptions.mergeNonAdjacentRules != 'selector') {
     mergeNonAdjacentByBody(tokens, context);
   }
 
-  if (levelOptions.restructuring && levelOptions.adjacentRulesMerging && withRestructuring) {
+  if (levelOptions.restructureRules && levelOptions.mergeAdjacentRules && withRestructuring) {
     restructure(tokens, context);
     mergeAdjacent(tokens, context);
   }
 
-  if (levelOptions.restructuring && !levelOptions.adjacentRulesMerging && withRestructuring) {
+  if (levelOptions.restructureRules && !levelOptions.mergeAdjacentRules && withRestructuring) {
     restructure(tokens, context);
   }
 
-  if (levelOptions.duplicateFontRulesRemoving) {
+  if (levelOptions.removeDuplicateFontRules) {
     removeDuplicateFontAtRules(tokens, context);
   }
 
-  if (levelOptions.duplicateMediaRemoving) {
+  if (levelOptions.removeDuplicateMediaBlocks) {
     removeDuplicateMediaQueries(tokens, context);
   }
 
-  if (levelOptions.mediaMerging) {
+  if (levelOptions.mergeMedia) {
     reduced = mergeMediaQueries(tokens, context);
     for (i = reduced.length - 1; i >= 0; i--) {
       level2Optimize(reduced[i][2], context, false);
index d54d090..51d2d2e 100644 (file)
@@ -32,16 +32,16 @@ DEFAULTS[OptimizationLevel.One] = {
   tidySelectors: true
 };
 DEFAULTS[OptimizationLevel.Two] = {
-  adjacentRulesMerging: true,
-  duplicateFontRulesRemoving: true,
-  duplicateMediaRemoving: true,
-  duplicateRulesRemoving: true,
-  mediaMerging: true,
-  nonAdjacentRulesMerging: true,
-  nonAdjacentRulesReducing: true,
-  restructuring: false,
-  semanticMerging: false,
-  shorthandCompacting: true
+  compactShorthands: true,
+  mergeAdjacentRules: true,
+  mergeMedia: true,
+  mergeNonAdjacentRules: true,
+  mergeSemantically: false,
+  reduceNonAdjacentRules: true,
+  removeDuplicateFontRules: true,
+  removeDuplicateMediaBlocks: true,
+  removeDuplicateRules: true,
+  restructureRules: false
 };
 
 var ALL_KEYWORD_1 = '*';
index a2386a4..40b6498 100644 (file)
@@ -50,7 +50,7 @@ function batchContexts() {
             keepBreaks: true,
             level: {
               2: {
-                restructuring: true
+                restructureRules: true
               }
             }
           }).minify(data.input, this.callback.bind(null, data));
@@ -66,7 +66,7 @@ function batchContexts() {
             keepBreaks: true,
             level: {
               2: {
-                restructuring: true
+                restructureRules: true
               }
             },
             sourceMap: true
@@ -79,7 +79,7 @@ function batchContexts() {
       'minifying via CLI': {
         'topic': function (data) {
           exec(
-            '__DIRECT__=1 ./bin/cleancss -b -O2 restructuring:on ' + (isIE7Mode ? '-c ie7 ' : '') + path.join(dir, filename),
+            '__DIRECT__=1 ./bin/cleancss -b -O2 restructureRules:on ' + (isIE7Mode ? '-c ie7 ' : '') + path.join(dir, filename),
             { maxBuffer: 500 * 1024 },
             this.callback.bind(null, data)
           );
index e10189a..32a1e14 100644 (file)
@@ -169,7 +169,7 @@ vows.describe('./bin/cleancss')
     })
   })
   .addBatch({
-    'enable restructuring optimizations': pipedContext('div{margin-top:0}.one{margin:0}.two{display:block;margin-top:0}', '-O2 restructuring:on', {
+    'enable restructuring optimizations': pipedContext('div{margin-top:0}.one{margin:0}.two{display:block;margin-top:0}', '-O2 restructureRules:on', {
       'should do basic optimizations only': function (error, stdout) {
         assert.equal(stdout, '.two,div{margin-top:0}.one{margin:0}.two{display:block}');
       }
@@ -460,7 +460,7 @@ vows.describe('./bin/cleancss')
     }
   })
   .addBatch({
-    '@media merging': pipedContext('@media screen{a{color:red}}@media screen{a{display:block}}', '-O2 mediaMerging:off', {
+    '@media merging': pipedContext('@media screen{a{color:red}}@media screen{a{display:block}}', '-O2 mergeMedia:off', {
       'gets right result': function (error, stdout) {
         assert.equal(stdout, '@media screen{a{color:red}}@media screen{a{display:block}}');
       }
@@ -468,7 +468,7 @@ vows.describe('./bin/cleancss')
   })
   .addBatch({
     'shorthand compacting': {
-      'of (yet) unmergeable properties': pipedContext('a{background:url(image.png);background-color:red}', '-O2 shorthandCompacting:off', {
+      'of (yet) unmergeable properties': pipedContext('a{background:url(image.png);background-color:red}', '-O2 compactShorthands:off', {
         'gets right result': function (error, stdout) {
           assert.equal(stdout, 'a{background:url(image.png);background-color:red}');
         }
@@ -622,7 +622,7 @@ vows.describe('./bin/cleancss')
           assert.equal(stdout, '.a{margin:0}.b{margin:10px;padding:0}.c{margin:0}');
         }
       }),
-      'enabled': pipedContext('.a{margin:0}.b{margin:10px;padding:0}.c{margin:0}', '-O2 semanticMerging:on', {
+      'enabled': pipedContext('.a{margin:0}.b{margin:10px;padding:0}.c{margin:0}', '-O2 mergeSemantically:on', {
         'should output right data': function (error, stdout) {
           assert.equal(stdout, '.a,.c{margin:0}.b{margin:10px;padding:0}');
         }
index de7ea43..137a308 100644 (file)
@@ -2221,7 +2221,7 @@ vows.describe('integration tests')
         '.one{color:red;margin:0}.two{color:red}.one{margin:0}',
         '.one,.two{color:red}.one{margin:0}'
       ]
-    }, { level: { 2: { restructuring: true } } })
+    }, { level: { 2: { restructureRules: true } } })
   )
   .addBatch(
     optimizerContext('units - IE8 compatibility', {
index f31e34f..a3ede00 100644 (file)
@@ -341,7 +341,7 @@ vows.describe('module tests').addBatch({
     },
     'restructuring - on': {
       'topic': function () {
-        new CleanCSS({ level: { 2: { restructuring: true } } }).minify('div{margin-top:0}.one{margin:0}.two{display:block;margin-top:0}', this.callback);
+        new CleanCSS({ level: { 2: { restructureRules: true } } }).minify('div{margin-top:0}.one{margin:0}.two{display:block;margin-top:0}', this.callback);
       },
       'gets right output': function (minified) {
         assert.equal(minified.styles, '.two,div{margin-top:0}.one{margin:0}.two{display:block}');
@@ -349,7 +349,7 @@ vows.describe('module tests').addBatch({
     },
     'restructuring - off': {
       'topic': function () {
-        return new CleanCSS({ level: { 2: { restructuring: false } } }).minify('div{margin-top:0}.one{margin:0}.two{display:block;margin-top:0}');
+        return new CleanCSS({ level: { 2: { restructureRules: false } } }).minify('div{margin-top:0}.one{margin:0}.two{display:block;margin-top:0}');
       },
       'gets right output': function (minified) {
         assert.equal(minified.styles, 'div{margin-top:0}.one{margin:0}.two{display:block;margin-top:0}');
@@ -365,7 +365,7 @@ vows.describe('module tests').addBatch({
     },
     'semantic merging - on': {
       'topic': function () {
-        return new CleanCSS({ level: { 2: { semanticMerging: true } } }).minify('.a{margin:0}.b{margin:10px;padding:0}.c{margin:0}');
+        return new CleanCSS({ level: { 2: { mergeSemantically: true } } }).minify('.a{margin:0}.b{margin:10px;padding:0}.c{margin:0}');
       },
       'gets right output': function (minified) {
         assert.equal(minified.styles, '.a,.c{margin:0}.b{margin:10px;padding:0}');
index 51431a7..dc09384 100644 (file)
@@ -21,10 +21,10 @@ function _optimize(source) {
     compatibility: compat,
     level: {
       2: {
-        mediaMerging: true,
-        restructuring: true,
-        semanticMerging: false,
-        shorthandCompacting: true
+        mergeMedia: true,
+        restructureRules: true,
+        mergeSemantically: false,
+        compactShorthands: true
       }
     }
   };
index cc3d42c..62d0735 100644 (file)
@@ -15,10 +15,10 @@ function _optimize(source, mergeAdjacent, aggressiveMerging, compatibilityOption
     compatibility: compat,
     level: {
       2: {
-        mediaMerging: false,
-        restructuring: false,
-        semanticMerging: false,
-        shorthandCompacting: false
+        mergeMedia: false,
+        restructureRules: false,
+        mergeSemantically: false,
+        compactShorthands: false
       }
     }
   };
index 5199bbb..e93bed4 100644 (file)
@@ -22,7 +22,7 @@ function _optimize(source, compat, aggressiveMerging) {
     compatibility: compat,
     level: {
       2: {
-        shorthandCompacting: true
+        compactShorthands: true
       }
     }
   };
index ed20af0..f0cfad8 100644 (file)
@@ -22,7 +22,7 @@ function _optimize(source) {
     compatibility: compat,
     level: {
       2: {
-        shorthandCompacting: true
+        compactShorthands: true
       }
     }
   };
index 62dca5e..fa3c262 100644 (file)
@@ -96,7 +96,7 @@ vows.describe('remove duplicates')
         '.one{color:red}@media print{.two{display:block}}.three{color:red}',
         '.one,.three{color:red}@media print{.two{display:block}}'
       ],
-    }, { level: { 2: { restructuring: true } } })
+    }, { level: { 2: { restructureRules: true } } })
   )
   .addBatch(
     optimizerContext('with level 2 off but only adjacentRuleMerging on', {
@@ -104,7 +104,7 @@ vows.describe('remove duplicates')
         'a{background:url(image.png)}a{display:block;width:75px;background-repeat:no-repeat}',
         'a{background:url(image.png);display:block;width:75px;background-repeat:no-repeat}',
       ],
-    }, { level: { 2: { all: false, adjacentRulesMerging: true } } })
+    }, { level: { 2: { all: false, mergeAdjacentRules: true } } })
   )
   .addBatch(
     optimizerContext('with level 2 off', {
index fdd1420..8aa1f9e 100644 (file)
@@ -116,7 +116,7 @@ vows.describe('merge media queries')
         '@media (max-width:1px){.block{margin:1px}}.block__element{margin:2px}@media (max-width:1px){.block--modifier{margin:3px}}',
         '.block__element{margin:2px}@media (max-width:1px){.block{margin:1px}.block--modifier{margin:3px}}'
       ]
-    }, { level: { 2: { semanticMerging: true } } })
+    }, { level: { 2: { mergeSemantically: true } } })
   )
   .addBatch(
     optimizerContext('with level 2 off', {
@@ -132,6 +132,6 @@ vows.describe('merge media queries')
         '@media screen{a{color:red}}@media screen{a{display:block}}',
         '@media screen{a{color:red}}@media screen{a{display:block}}'
       ]
-    }, { level: { 2: { mediaMerging: false } } })
+    }, { level: { 2: { mergeMedia: false } } })
   )
   .export(module);
index e995977..0e7831c 100644 (file)
@@ -35,20 +35,20 @@ vows.describe('merge non djacent by body')
     }, { level: 2 })
   )
   .addBatch(
-    optimizerContext('with level 2 off but nonAdjacentRulesMerging on', {
+    optimizerContext('with level 2 off but mergeNonAdjacentRules on', {
       'of element selectors': [
         'p{color:red}div{display:block}span{color:red}',
         'p,span{color:red}div{display:block}'
       ]
-    }, { level: { 2: { all: false, nonAdjacentRulesMerging: true } } })
+    }, { level: { 2: { all: false, mergeNonAdjacentRules: true } } })
   )
   .addBatch(
-    optimizerContext('with level 2 off but nonAdjacentRulesMerging set to selector', {
+    optimizerContext('with level 2 off but mergeNonAdjacentRules set to selector', {
       'of element selectors': [
         'p{color:red}div{display:block}span{color:red}',
         'p{color:red}div{display:block}span{color:red}'
       ]
-    }, { level: { 2: { all: false, nonAdjacentRulesMerging: 'selector' } } })
+    }, { level: { 2: { all: false, mergeNonAdjacentRules: 'selector' } } })
   )
   .addBatch(
     optimizerContext('with level 2 off', {
@@ -101,7 +101,7 @@ vows.describe('merge non djacent by body')
         '.block1__element{color:#000}.block1__element--modifier{color:red}.block2{color:#000;display:block;width:100%}'
         // '.block1__element,.block2{color:#000}.block1__element--modifier{color:red}.block2{display:block;width:100%}' - pending #588
       ]
-    }, { level: { 2: { restructuring: true, semanticMerging: true } } })
+    }, { level: { 2: { restructureRules: true, mergeSemantically: true } } })
   )
   .addBatch(
     optimizerContext('IE8 compatibility', {
index 6f1414f..8065770 100644 (file)
@@ -19,20 +19,20 @@ vows.describe('merge non djacent by selector')
     }, { level: 2 })
   )
   .addBatch(
-    optimizerContext('with level 2 off but nonAdjacentRulesMerging on', {
+    optimizerContext('with level 2 off but mergeNonAdjacentRules on', {
       'of element selectors': [
         '.one{color:red}.two{color:#fff}.one{font-weight:400}',
         '.one{color:red;font-weight:400}.two{color:#fff}'
       ]
-    }, { level: { 2: { all: false, nonAdjacentRulesMerging: true } } })
+    }, { level: { 2: { all: false, mergeNonAdjacentRules: true } } })
   )
   .addBatch(
-    optimizerContext('with level 2 off but nonAdjacentRulesMerging set to body', {
+    optimizerContext('with level 2 off but mergeNonAdjacentRules set to body', {
       'of element selectors': [
         '.one{color:red}.two{color:#fff}.one{font-weight:400}',
         '.one{color:red}.two{color:#fff}.one{font-weight:400}'
       ]
-    }, { level: { 2: { all: false, nonAdjacentRulesMerging: 'body' } } })
+    }, { level: { 2: { all: false, mergeNonAdjacentRules: 'body' } } })
   )
   .addBatch(
     optimizerContext('level 2 off', {
index 9709735..03463a1 100644 (file)
@@ -116,7 +116,7 @@ vows.describe('remove duplicates')
         'a{padding:10px;margin:0;color:red}.one{color:red}a,p{color:red;padding:0}.one,a{color:#fff}',
         'a{margin:0}a,p{color:red;padding:0}.one,a{color:#fff}'
       ]
-    }, { level: { 2: { restructuring: true } } })
+    }, { level: { 2: { restructureRules: true } } })
   )
   .addBatch(
     optimizerContext('level 2 on and aggressive merging off', {
@@ -124,15 +124,15 @@ vows.describe('remove duplicates')
         'a{padding:10px;margin:0;color:red}.one{color:red}a,p{color:red;padding:0}',
         '.one,a,p{color:red}a{padding:10px;margin:0}a,p{padding:0}'
       ]
-    }, { aggressiveMerging: false, level: { 2: { restructuring: true } } })
+    }, { aggressiveMerging: false, level: { 2: { restructureRules: true } } })
   )
   .addBatch(
-    optimizerContext('level 2 off but nonAdjacentRulesReducing on', {
+    optimizerContext('level 2 off but reduceNonAdjacentRules on', {
       'non-adjacent with multi selectors': [
         'a{padding:10px;margin:0;color:red}.one{color:red}a,p{color:red;padding:0}',
         'a{margin:0;color:red}.one{color:red}a,p{color:red;padding:0}'
       ]
-    }, { level: { 2: { all: false, nonAdjacentRulesReducing: true } } })
+    }, { level: { 2: { all: false, reduceNonAdjacentRules: true } } })
   )
   .addBatch(
     optimizerContext('level 2 off', {
index 7ed12eb..cba1ae0 100644 (file)
@@ -19,12 +19,12 @@ vows.describe('remove duplicate @font-face at-rules')
     }, { level: 2 })
   )
   .addBatch(
-    optimizerContext('level 2 off but duplicateFontRulesRemoving on', {
+    optimizerContext('level 2 off but removeDuplicateFontRules on', {
       'non-adjacent': [
         '@font-face{font-family:test;src:url(fonts/test.woff2)}.one{color:red}@font-face{font-family:test;src:url(fonts/test.woff2)}',
         '@font-face{font-family:test;src:url(fonts/test.woff2)}.one{color:red}'
       ]
-    }, { level: { 2: { all: false, duplicateFontRulesRemoving: true } } })
+    }, { level: { 2: { all: false, removeDuplicateFontRules: true } } })
   )
   .addBatch(
     optimizerContext('level 2 off', {
index cfa9e51..6f7c40b 100644 (file)
@@ -23,12 +23,12 @@ vows.describe('remove duplicate media queries')
     }, { level: 2 })
   )
   .addBatch(
-    optimizerContext('level 2 off but duplicateMediaRemoving on', {
+    optimizerContext('level 2 off but removeDuplicateMediaBlocks on', {
       'non-adjacent': [
         '@media screen{a{color:red}}@media print{a{color:#fff}}@media screen{a{color:red}}',
         '@media print{a{color:#fff}}@media screen{a{color:red}}'
       ]
-    }, { level: { 2: { all: false, duplicateMediaRemoving: true } } })
+    }, { level: { 2: { all: false, removeDuplicateMediaBlocks: true } } })
   )
   .addBatch(
     optimizerContext('level 2 off', {
@@ -44,6 +44,6 @@ vows.describe('remove duplicate media queries')
         '@media screen{a{color:red}}@media screen{div{color:red}}',
         '@media screen{a{color:red}}@media screen{div{color:red}}'
       ]
-    }, { level: { 2: { mediaMerging: false } } })
+    }, { level: { 2: { mergeMedia: false } } })
   )
   .export(module);
index 4c84bda..e2a387a 100644 (file)
@@ -48,7 +48,7 @@ vows.describe('remove duplicates')
         'a{color:red}div{color:blue}a{color:red}',
         'div{color:#00f}a{color:red}'
       ]
-    }, { level: { 2: { all: false, duplicateRulesRemoving: true } } })
+    }, { level: { 2: { all: false, removeDuplicateRules: true } } })
   )
   .addBatch(
     optimizerContext('level 2 off', {
index 0d20b33..567f892 100644 (file)
@@ -164,7 +164,7 @@ vows.describe('restructure')
         '.one{border-color:#000;border-bottom-color:rgb(0,0,0,.2)}.two{border-color:#fff;border-bottom-color:rgb(0,0,0,.2)}',
         '.one{border-color:#000;border-bottom-color:rgb(0,0,0,.2)}.two{border-color:#fff;border-bottom-color:rgb(0,0,0,.2)}'
       ]
-    }, { level: { 2: { restructuring: true } } })
+    }, { level: { 2: { restructureRules: true } } })
   )
   .addBatch(
     optimizerContext('level 2 off', {
index 932e7ba..2cb1c58 100644 (file)
@@ -121,16 +121,16 @@ vows.describe(optimizationLevelFrom)
       },
       'has level 2 options': function (levelOptions) {
         assert.deepEqual(levelOptions['2'], {
-          adjacentRulesMerging: true,
-          duplicateFontRulesRemoving: true,
-          duplicateMediaRemoving: true,
-          duplicateRulesRemoving: true,
-          mediaMerging: true,
-          nonAdjacentRulesMerging: true,
-          nonAdjacentRulesReducing: true,
-          restructuring: false,
-          semanticMerging: false,
-          shorthandCompacting: true
+          compactShorthands: true,
+          mergeAdjacentRules: true,
+          mergeMedia: true,
+          mergeNonAdjacentRules: true,
+          mergeSemantically: false,
+          reduceNonAdjacentRules: true,
+          removeDuplicateFontRules: true,
+          removeDuplicateMediaBlocks: true,
+          removeDuplicateRules: true,
+          restructureRules: false
         });
       }
     },
@@ -180,16 +180,16 @@ vows.describe(optimizationLevelFrom)
       },
       'has level 2 options': function (levelOptions) {
         assert.deepEqual(levelOptions['2'], {
-          adjacentRulesMerging: true,
-          duplicateFontRulesRemoving: true,
-          duplicateMediaRemoving: true,
-          duplicateRulesRemoving: true,
-          mediaMerging: true,
-          nonAdjacentRulesMerging: true,
-          nonAdjacentRulesReducing: true,
-          restructuring: false,
-          semanticMerging: false,
-          shorthandCompacting: true
+          compactShorthands: true,
+          mergeAdjacentRules: true,
+          mergeMedia: true,
+          mergeNonAdjacentRules: true,
+          mergeSemantically: false,
+          reduceNonAdjacentRules: true,
+          removeDuplicateFontRules: true,
+          removeDuplicateMediaBlocks: true,
+          removeDuplicateRules: true,
+          restructureRules: false
         });
       }
     },
@@ -263,7 +263,7 @@ vows.describe(optimizationLevelFrom)
     },
     'a hash with all keyword for level 2': {
       'topic': function () {
-        return optimizationLevelFrom({ 1: { specialComments: 0 }, 2: { all: false, mediaMerging: true } });
+        return optimizationLevelFrom({ 1: { specialComments: 0 }, 2: { all: false, mergeMedia: true } });
       },
       'has all options': function (levelOptions) {
         assert.deepEqual(Object.keys(levelOptions), ['0', '1', '2']);
@@ -296,22 +296,22 @@ vows.describe(optimizationLevelFrom)
       },
       'has level 2 options': function (levelOptions) {
         assert.deepEqual(levelOptions['2'], {
-          adjacentRulesMerging: false,
-          duplicateFontRulesRemoving: false,
-          duplicateMediaRemoving: false,
-          duplicateRulesRemoving: false,
-          mediaMerging: true,
-          nonAdjacentRulesMerging: false,
-          nonAdjacentRulesReducing: false,
-          restructuring: false,
-          semanticMerging: false,
-          shorthandCompacting: false
+          compactShorthands: false,
+          mergeAdjacentRules: false,
+          mergeMedia: true,
+          mergeNonAdjacentRules: false,
+          mergeSemantically: false,
+          reduceNonAdjacentRules: false,
+          removeDuplicateFontRules: false,
+          removeDuplicateMediaBlocks: false,
+          removeDuplicateRules: false,
+          restructureRules: false
         });
       }
     },
     'a hash with * keyword for level 2': {
       'topic': function () {
-        return optimizationLevelFrom({ 1: { specialComments: 0 }, 2: { '*': false, mediaMerging: true } });
+        return optimizationLevelFrom({ 1: { specialComments: 0 }, 2: { '*': false, mergeMedia: true } });
       },
       'has all options': function (levelOptions) {
         assert.deepEqual(Object.keys(levelOptions), ['0', '1', '2']);
@@ -344,16 +344,16 @@ vows.describe(optimizationLevelFrom)
       },
       'has level 2 options': function (levelOptions) {
         assert.deepEqual(levelOptions['2'], {
-          adjacentRulesMerging: false,
-          duplicateFontRulesRemoving: false,
-          duplicateMediaRemoving: false,
-          duplicateRulesRemoving: false,
-          mediaMerging: true,
-          nonAdjacentRulesMerging: false,
-          nonAdjacentRulesReducing: false,
-          restructuring: false,
-          semanticMerging: false,
-          shorthandCompacting: false
+          compactShorthands: false,
+          mergeAdjacentRules: false,
+          mergeMedia: true,
+          mergeNonAdjacentRules: false,
+          mergeSemantically: false,
+          reduceNonAdjacentRules: false,
+          removeDuplicateFontRules: false,
+          removeDuplicateMediaBlocks: false,
+          removeDuplicateRules: false,
+          restructureRules: false
         });
       }
     },
@@ -393,7 +393,7 @@ vows.describe(optimizationLevelFrom)
     },
     'a hash with options as strings with boolean values': {
       'topic': function () {
-        return optimizationLevelFrom({ 2: 'mediaMerging:false;semanticMerging:true' });
+        return optimizationLevelFrom({ 2: 'mergeMedia:false;mergeSemantically:true' });
       },
       'has all options': function (levelOptions) {
         assert.deepEqual(Object.keys(levelOptions), ['0', '1', '2']);
@@ -426,22 +426,22 @@ vows.describe(optimizationLevelFrom)
       },
       'has level 2 options': function (levelOptions) {
         assert.deepEqual(levelOptions['2'], {
-          adjacentRulesMerging: true,
-          duplicateFontRulesRemoving: true,
-          duplicateMediaRemoving: true,
-          duplicateRulesRemoving: true,
-          mediaMerging: false,
-          nonAdjacentRulesMerging: true,
-          nonAdjacentRulesReducing: true,
-          restructuring: false,
-          semanticMerging: true,
-          shorthandCompacting: true
+          compactShorthands: true,
+          mergeAdjacentRules: true,
+          mergeMedia: false,
+          mergeNonAdjacentRules: true,
+          mergeSemantically: true,
+          reduceNonAdjacentRules: true,
+          removeDuplicateFontRules: true,
+          removeDuplicateMediaBlocks: true,
+          removeDuplicateRules: true,
+          restructureRules: false
         });
       }
     },
     'a hash with options as strings with boolean values as on/off': {
       'topic': function () {
-        return optimizationLevelFrom({ 2: 'mediaMerging:off;semanticMerging:on' });
+        return optimizationLevelFrom({ 2: 'mergeMedia:off;mergeSemantically:on' });
       },
       'has all options': function (levelOptions) {
         assert.deepEqual(Object.keys(levelOptions), ['0', '1', '2']);
@@ -474,22 +474,22 @@ vows.describe(optimizationLevelFrom)
       },
       'has level 2 options': function (levelOptions) {
         assert.deepEqual(levelOptions['2'], {
-          adjacentRulesMerging: true,
-          duplicateFontRulesRemoving: true,
-          duplicateMediaRemoving: true,
-          duplicateRulesRemoving: true,
-          mediaMerging: false,
-          nonAdjacentRulesMerging: true,
-          nonAdjacentRulesReducing: true,
-          restructuring: false,
-          semanticMerging: true,
-          shorthandCompacting: true
+          compactShorthands: true,
+          mergeAdjacentRules: true,
+          mergeMedia: false,
+          mergeNonAdjacentRules: true,
+          mergeSemantically: true,
+          reduceNonAdjacentRules: true,
+          removeDuplicateFontRules: true,
+          removeDuplicateMediaBlocks: true,
+          removeDuplicateRules: true,
+          restructureRules: false
         });
       }
     },
     'a hash with options as strings with all keyword': {
       'topic': function () {
-        return optimizationLevelFrom({ 2: 'all:false;mediaMerging:true;semanticMerging:true' });
+        return optimizationLevelFrom({ 2: 'all:false;mergeMedia:true;mergeSemantically:true' });
       },
       'has all options': function (levelOptions) {
         assert.deepEqual(Object.keys(levelOptions), ['0', '1', '2']);
@@ -522,22 +522,22 @@ vows.describe(optimizationLevelFrom)
       },
       'has level 2 options': function (levelOptions) {
         assert.deepEqual(levelOptions['2'], {
-          adjacentRulesMerging: false,
-          duplicateFontRulesRemoving: false,
-          duplicateMediaRemoving: false,
-          duplicateRulesRemoving: false,
-          mediaMerging: true,
-          nonAdjacentRulesMerging: false,
-          nonAdjacentRulesReducing: false,
-          restructuring: false,
-          semanticMerging: true,
-          shorthandCompacting: false
+          compactShorthands: false,
+          mergeAdjacentRules: false,
+          mergeMedia: true,
+          mergeNonAdjacentRules: false,
+          mergeSemantically: true,
+          reduceNonAdjacentRules: false,
+          removeDuplicateFontRules: false,
+          removeDuplicateMediaBlocks: false,
+          removeDuplicateRules: false,
+          restructureRules: false
         });
       }
     },
     'a hash with options as strings with * keyword': {
       'topic': function () {
-        return optimizationLevelFrom({ 2: '*:false;mediaMerging:true;semanticMerging:true' });
+        return optimizationLevelFrom({ 2: '*:false;mergeMedia:true;mergeSemantically:true' });
       },
       'has all options': function (levelOptions) {
         assert.deepEqual(Object.keys(levelOptions), ['0', '1', '2']);
@@ -570,16 +570,16 @@ vows.describe(optimizationLevelFrom)
       },
       'has level 2 options': function (levelOptions) {
         assert.deepEqual(levelOptions['2'], {
-          adjacentRulesMerging: false,
-          duplicateFontRulesRemoving: false,
-          duplicateMediaRemoving: false,
-          duplicateRulesRemoving: false,
-          mediaMerging: true,
-          nonAdjacentRulesMerging: false,
-          nonAdjacentRulesReducing: false,
-          restructuring: false,
-          semanticMerging: true,
-          shorthandCompacting: false
+          compactShorthands: false,
+          mergeAdjacentRules: false,
+          mergeMedia: true,
+          mergeNonAdjacentRules: false,
+          mergeSemantically: true,
+          reduceNonAdjacentRules: false,
+          removeDuplicateFontRules: false,
+          removeDuplicateMediaBlocks: false,
+          removeDuplicateRules: false,
+          restructureRules: false
         });
       }
     },
index 5ef05fe..d22079b 100644 (file)
@@ -1816,7 +1816,7 @@ vows.describe('source-map')
     'level 2 optimizations': {
       'new property in restructuring': {
         'topic': function () {
-          return new CleanCSS({ level: { 2: { restructuring: true } }, sourceMap: true }).minify('a{color:#000}div{color:red}.one{display:block}.two{display:inline;color:red}');
+          return new CleanCSS({ level: { 2: { restructureRules: true } }, sourceMap: true }).minify('a{color:#000}div{color:red}.one{display:block}.two{display:inline;color:red}');
         },
         'has right output': function (minified) {
           assert.equal(minified.styles, 'a{color:#000}.two,div{color:red}.one{display:block}.two{display:inline}');