Cast in options object rather than command line
authorvlakoff <vlakoff@gmail.com>
Sat, 29 Oct 2016 08:08:02 +0000 (10:08 +0200)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 1 Nov 2016 06:52:11 +0000 (07:52 +0100)
bin/cleancss
lib/clean.js

index 3bd1e39..f4030b9 100755 (executable)
@@ -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,
index 4838c8d..e92d324 100644 (file)
@@ -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,