[Pkg-javascript-commits] [less.js] 11/38: Deprecate compression option. Fixes #2318

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:27:24 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.2.0
in repository less.js.

commit 39a93cb9bae8f7fbd7528291ca132770035689d6
Author: Luke Page <luke.a.page at gmail.com>
Date:   Thu Jan 1 17:38:40 2015 +0000

    Deprecate compression option. Fixes #2318
---
 bin/lessc                     |  3 ++-
 lib/less-node/lessc-helper.js |  3 ++-
 lib/less/parse-tree.js        | 10 ++++++++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/bin/lessc b/bin/lessc
index 6cf6cf7..bc01932 100755
--- a/bin/lessc
+++ b/bin/lessc
@@ -369,7 +369,8 @@ var parseLessFile = function (e, data) {
             }
         },
         warn: function(msg) {
-            if (!silent) {
+            // do not show warning if outputting css to the console or the silent option is used
+            if (!silent && output) {
                 console.warn(msg);
             }
         },
diff --git a/lib/less-node/lessc-helper.js b/lib/less-node/lessc-helper.js
index 80eedef..8a7fe60 100644
--- a/lib/less-node/lessc-helper.js
+++ b/lib/less-node/lessc-helper.js
@@ -37,7 +37,6 @@ var lessc_helper = {
         console.log("  --strict-imports         Forces evaluation of imports.");
         console.log("  --insecure               Allows imports from insecure https hosts.");
         console.log("  -v, --version            Prints version number and exit.");
-        console.log("  -x, --compress           Compresses output by removing some whitespaces.");
         console.log("  --source-map[=FILENAME]  Outputs a v3 sourcemap to the filename (or output filename.map).");
         console.log("  --source-map-rootpath=X  Adds this path onto the sourcemap filename and less file paths.");
         console.log("  --source-map-basepath=X  Sets sourcemap base path, defaults to current working directory.");
@@ -71,6 +70,8 @@ var lessc_helper = {
         console.log("                           media query which is compatible with the SASS");
         console.log("                           format, and 'all' which will do both.");
         console.log("  --verbose                Be verbose.");
+	    console.log("  -x, --compress           Compresses output by removing some whitespaces.");
+	    console.log("                           We recommend you use a dedicated minifer like less-plugin-clean-css");
         console.log("");
         console.log("Report bugs to: http://github.com/less/less.js/issues");
         console.log("Home page: <http://lesscss.org/>");
diff --git a/lib/less/parse-tree.js b/lib/less/parse-tree.js
index 143cf2e..73b49b1 100644
--- a/lib/less/parse-tree.js
+++ b/lib/less/parse-tree.js
@@ -1,5 +1,6 @@
 var LessError = require('./less-error'),
-    transformTree = require("./transform-tree");
+    transformTree = require("./transform-tree"),
+	logger = require("./logger");
 
 module.exports = function(SourceMapBuilder) {
 var ParseTree = function(root, imports) {
@@ -16,8 +17,13 @@ ParseTree.prototype.toCSS = function(options) {
     }
 
     try {
+	    var compress = Boolean(options.compress);
+	    if (compress) {
+		    logger.warn("The compress option has been deprecated. We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.");
+	    }
+	    
         var toCSSOptions = {
-            compress: Boolean(options.compress),
+            compress: compress,
             dumpLineNumbers: options.dumpLineNumbers,
             strictUnits: Boolean(options.strictUnits),
             numPrecision: 8};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list