From 50a93065c63c4cd5b8a164552e2a323694d2e681 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Sat, 29 Oct 2016 10:08:02 +0200 Subject: [PATCH] Cast in options object rather than command line --- bin/cleancss | 4 ++-- lib/clean.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/cleancss b/bin/cleancss index 3bd1e395..f4030b91 100755 --- a/bin/cleancss +++ b/bin/cleancss @@ -22,7 +22,7 @@ commands .option('-r, --root [root-path]', 'Set a root path to which resolve absolute @import rules') .option('-s, --skip-import', 'Disable @import processing') .option('-t, --timeout [seconds]', 'Per connection timeout when fetching remote @imports (defaults to 5 seconds)') - .option('--rounding-precision [n]', 'Rounds pixel values to `N` decimal places. Defaults to 2. -1 disables rounding', parseInt) + .option('--rounding-precision [n]', 'Rounds pixel values to `N` decimal places. Defaults to 2. -1 disables rounding') .option('--s0', 'Remove all special comments, i.e. /*! comment */') .option('--s1', 'Remove all special comments but the first one') .option('--semantic-merging', 'Enables unsafe mode by assuming BEM-like semantic stylesheets (warning, this may break your styling!)') @@ -74,7 +74,7 @@ var options = { rebase: commands.skipRebase ? false : true, restructuring: commands.skipRestructuring ? false : true, root: commands.root, - roundingPrecision: commands.roundingPrecision, + roundingPrecision: commands.roundingPrecision === undefined ? undefined : parseInt(commands.roundingPrecision), semanticMerging: commands.semanticMerging ? true : false, shorthandCompacting: commands.skipShorthandCompacting ? false : true, sourceMap: commands.sourceMap, diff --git a/lib/clean.js b/lib/clean.js index 4838c8d2..e92d324d 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -55,7 +55,7 @@ var CleanCSS = module.exports = function CleanCSS(options) { relativeTo: options.relativeTo, restructuring: undefined === options.restructuring ? true : !!options.restructuring, root: options.root || process.cwd(), - roundingPrecision: options.roundingPrecision, + roundingPrecision: undefined === options.roundingPrecision ? undefined : parseInt(options.roundingPrecision), semanticMerging: undefined === options.semanticMerging ? false : !!options.semanticMerging, shorthandCompacting: undefined === options.shorthandCompacting ? true : !!options.shorthandCompacting, sourceMap: options.sourceMap, -- 2.34.1