From: Jakub Pawlowicz Date: Fri, 10 Oct 2014 06:35:33 +0000 (+0100) Subject: Renames `noAggressiveMerging` option into `aggressiveMerging`. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=ca1be91a6cdbc881b98d7f374a86aa3d96325aa5;p=clean-css.git Renames `noAggressiveMerging` option into `aggressiveMerging`. --- diff --git a/History.md b/History.md index 4cbb4b16..bc9d9d76 100644 --- a/History.md +++ b/History.md @@ -6,6 +6,7 @@ * Reworks minification to tokenize first then minify. See [changes](https://github.com/jakubpawlowicz/clean-css/compare/b06f37d...dd8c14a). * Renames `noAdvanced` option into `advanced`. +* Renames `noAggressiveMerging` option into `aggressiveMerging`. * Speeds up advanced processing by shortening optimize loop. * Fixed issue [#360](https://github.com/GoalSmashers/clean-css/issues/360) - adds 7 extra CSS colors. diff --git a/README.md b/README.md index 65913918..6e11e2ff 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ npm install clean-css #### Module interface * `noAdvanced` became `advanced` - make sure to reverse the value; +* `noAggressiveMerging` became `aggressiveMerging` - make sure to reverse the value; * no longer possible to use `CleanCSS` as a function as `new CleanCSS` is always required; ### How to upgrade clean-css from 1.x to 2.x? @@ -131,13 +132,13 @@ CleanCSS constructor accepts a hash as a parameter, i.e., `new CleanCSS(options).minify(source)` with the following options available: * `advanced` - set to false to disable advanced optimizations - selector & property merging, reduction, etc. +* `aggressiveMerging` - set to false to disable aggressive merging of properties. * `benchmark` - turns on benchmarking mode measuring time spent on cleaning up (run `npm run bench` to see example) * `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) * `inliner` - a hash of options for `@import` inliner, see test/protocol-imports-test.js for examples * `keepBreaks` - whether to keep line breaks (default is false) * `keepSpecialComments` - `*` for keeping all (default), `1` for keeping first one only, `0` for removing all -* `noAggressiveMerging` - set to true to disable aggressive merging of properties. * `noRebase` - whether to skip URLs rebasing * `processImport` - whether to process `@import` rules * `relativeTo` - path to __resolve__ relative `@import` rules and URLs diff --git a/bin/cleancss b/bin/cleancss index ace2f255..ef94f66f 100755 --- a/bin/cleancss +++ b/bin/cleancss @@ -77,7 +77,7 @@ if (commands.skipRebase) if (commands.skipAdvanced) cleanOptions.advanced = false; if (commands.skipAggressiveMerging) - cleanOptions.noAggressiveMerging = true; + cleanOptions.aggressiveMerging = false; if (commands.compatibility) cleanOptions.compatibility = commands.compatibility; if (commands.roundingPrecision !== undefined) diff --git a/lib/clean.js b/lib/clean.js index c6712aae..791e170b 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -19,13 +19,13 @@ var CleanCSS = module.exports = function CleanCSS(options) { this.options = { advanced: options.advanced === undefined ? true : false, + aggressiveMerging: undefined === options.aggressiveMerging ? true : false, benchmark: options.benchmark, compatibility: options.compatibility, debug: options.debug, inliner: options.inliner, keepBreaks: options.keepBreaks || false, keepSpecialComments: 'keepSpecialComments' in options ? options.keepSpecialComments : '*', - noAggressiveMerging: options.noAggressiveMerging, noRebase: options.noRebase, processImport: undefined === options.processImport ? true : false, relativeTo: options.relativeTo, @@ -120,7 +120,7 @@ function minify(data) { keepBreaks: options.keepBreaks, advanced: options.advanced, compatibility: options.compatibility, - aggressiveMerging: !options.noAggressiveMerging, + aggressiveMerging: options.aggressiveMerging, roundingPrecision: options.roundingPrecision }, context); diff --git a/test/integration-test.js b/test/integration-test.js index 1eef650d..636a91f4 100644 --- a/test/integration-test.js +++ b/test/integration-test.js @@ -1594,7 +1594,7 @@ title']{display:block}", 'a{background:red;display:block;background:white}', 'a{display:block;background:#fff}' ] - }, { noAggressiveMerging: true }), + }, { aggressiveMerging: false }), 'same selectors': cssContext({ 'of two non-adjacent selectors': '.one{color:red}.two{color:#00f}.one{font-weight:700}', 'of two adjacent single selectors': [