From ada94896cbcac6d9df29290686e4b50b3800cb22 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 10 Oct 2014 07:45:56 +0100 Subject: [PATCH] Renames `noRebase` option into `rebase`. --- History.md | 1 + README.md | 3 ++- bin/cleancss | 4 ++-- lib/clean.js | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/History.md b/History.md index bc9d9d76..b2e8e6f4 100644 --- a/History.md +++ b/History.md @@ -7,6 +7,7 @@ See [changes](https://github.com/jakubpawlowicz/clean-css/compare/b06f37d...dd8c14a). * Renames `noAdvanced` option into `advanced`. * Renames `noAggressiveMerging` option into `aggressiveMerging`. +* Renames `noRebase` option into `rebase`. * 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 6e11e2ff..5d82b704 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ npm install clean-css * `noAdvanced` became `advanced` - make sure to reverse the value; * `noAggressiveMerging` became `aggressiveMerging` - make sure to reverse the value; +* `noRebase` became `rebase` - 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? @@ -139,8 +140,8 @@ CleanCSS constructor accepts a hash as a parameter, i.e., * `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 -* `noRebase` - whether to skip URLs rebasing * `processImport` - whether to process `@import` rules +* `rebase` - set to false to skip URL rebasing * `relativeTo` - path to __resolve__ relative `@import` rules and URLs * `root` - path to __resolve__ absolute `@import` rules and __rebase__ relative URLs * `roundingPrecision` - Rounding precision, defaults to 2. diff --git a/bin/cleancss b/bin/cleancss index ef94f66f..b8d58c63 100755 --- a/bin/cleancss +++ b/bin/cleancss @@ -73,7 +73,7 @@ if (commands.root) if (commands.skipImport) cleanOptions.processImport = false; if (commands.skipRebase) - cleanOptions.noRebase = true; + cleanOptions.rebase = false; if (commands.skipAdvanced) cleanOptions.advanced = false; if (commands.skipAggressiveMerging) @@ -87,7 +87,7 @@ if (commands.debug) if (commands.timeout) cleanOptions.inliner = { timeout: parseFloat(commands.timeout) * 1000 }; if (commands.args.length > 0) { - var relativeTo = (cleanOptions.noRebase ? false : cleanOptions.root) || commands.args[0]; + var relativeTo = (cleanOptions.rebase ? cleanOptions.root : false) || commands.args[0]; cleanOptions.relativeTo = path.dirname(path.resolve(relativeTo)); options.sources = commands.args.map(function(source) { diff --git a/lib/clean.js b/lib/clean.js index 791e170b..3514a8d4 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -26,8 +26,8 @@ var CleanCSS = module.exports = function CleanCSS(options) { inliner: options.inliner, keepBreaks: options.keepBreaks || false, keepSpecialComments: 'keepSpecialComments' in options ? options.keepSpecialComments : '*', - noRebase: options.noRebase, processImport: undefined === options.processImport ? true : false, + rebase: undefined === options.rebase ? true : false, relativeTo: options.relativeTo, root: options.root, roundingPrecision: options.roundingPrecision, @@ -141,7 +141,7 @@ function minify(data) { run(selectorsOptimizer, 'process'); run(freeTextProcessor, 'restore'); run(urlsProcessor, 'restore'); - run(urlRebase, 'process', !options.noRebase); + run(urlRebase, 'process', options.rebase); run(expressionsProcessor, 'restore'); run(commentsProcessor, 'restore'); -- 2.34.1