[Pkg-javascript-commits] [less.js] 84/285: move cleancss into lessc bin only

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


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

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

commit e108b50c51e0cbb0653ec82e9de83e01d8dabedc
Author: Luke Page <luke.a.page at gmail.com>
Date:   Wed Sep 3 18:33:19 2014 +0100

    move cleancss into lessc bin only
---
 bin/lessc                       | 15 +++++++++++++++
 lib/less/contexts.js            |  2 --
 lib/less/environment/browser.js |  2 --
 lib/less/environment/node.js    |  3 ---
 lib/less/parser/parser.js       | 16 +---------------
 5 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/bin/lessc b/bin/lessc
index f9e0b70..9edcd95 100755
--- a/bin/lessc
+++ b/bin/lessc
@@ -372,6 +372,21 @@ var parseLessFile = function (e, data) {
     less.render(data, options)
         .then(function(css) {
             if(!options.lint) {
+                if (options.cleancss) {
+                    var CleanCSS = require('clean-css');
+                    var cleancssOptions = options.cleancssOptions || {};
+
+                    if (cleancssOptions.keepSpecialComments === undefined) {
+                        cleancssOptions.keepSpecialComments = "*";
+                    }
+                    cleancssOptions.processImport = false;
+                    cleancssOptions.noRebase = true;
+                    if (cleancssOptions.noAdvanced === undefined) {
+                        cleancssOptions.noAdvanced = true;
+                    }
+
+                    css = new CleanCSS(cleancssOptions).minify(css);
+                }
                 if (output) {
                     ensureDirectory(output);
                     fs.writeFileSync(output, css, 'utf8');
diff --git a/lib/less/contexts.js b/lib/less/contexts.js
index 269048a..c79349e 100644
--- a/lib/less/contexts.js
+++ b/lib/less/contexts.js
@@ -69,11 +69,9 @@ var evalCopyProperties = [
     'silent',         // whether to swallow errors and warnings
     'verbose',        // whether to log more activity
     'compress',       // whether to compress
-    'yuicompress',    // whether to compress with the outside tool yui compressor
     'ieCompat',       // whether to enforce IE compatibility (IE8 data-uri)
     'strictMath',     // whether math has to be within parenthesis
     'strictUnits',    // whether units need to evaluate correctly
-    'cleancss',       // whether to compress with clean-css
     'sourceMap',      // whether to output a source map
     'importMultiple', // whether we are currently importing multiple copies
     'urlArgs',        // whether to add args into url tokens
diff --git a/lib/less/environment/browser.js b/lib/less/environment/browser.js
index 85a9f64..2e045c7 100644
--- a/lib/less/environment/browser.js
+++ b/lib/less/environment/browser.js
@@ -44,8 +44,6 @@ return {
     alwaysMakePathsAbsolute: function alwaysMakePathsAbsolute() {
         return true;
     },
-    getCleanCSS: function () {
-    },
     supportsDataURI: function() {
         return false;
     },
diff --git a/lib/less/environment/node.js b/lib/less/environment/node.js
index 884f6eb..9c2f8e9 100644
--- a/lib/less/environment/node.js
+++ b/lib/less/environment/node.js
@@ -23,9 +23,6 @@ module.exports = {
     readFileSync: function (filename) {
         return require("fs").readFileSync(filename);
     },
-    getCleanCSS: function() {
-        return require('clean-css');
-    },
     getPath: function (env, filename) {
         var j = filename.lastIndexOf('/');
         if (j < 0) {
diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js
index d870c8f..6d19dd9 100644
--- a/lib/less/parser/parser.js
+++ b/lib/less/parser/parser.js
@@ -176,21 +176,7 @@ var Parser = function Parser(env) {
                         throw new LessError(parser, e, env);
                     }
 
-                    var CleanCSS = environment.getCleanCSS();
-                    if (options.cleancss && CleanCSS) {
-                        var cleancssOptions = options.cleancssOptions || {};
-
-                        if (cleancssOptions.keepSpecialComments === undefined) {
-                            cleancssOptions.keepSpecialComments = "*";
-                        }
-                        cleancssOptions.processImport = false;
-                        cleancssOptions.noRebase = true;
-                        if (cleancssOptions.noAdvanced === undefined) {
-                            cleancssOptions.noAdvanced = true;
-                        }
-
-                        return new CleanCSS(cleancssOptions).minify(css);
-                    } else if (options.compress) {
+                    if (options.compress) {
                         return css.replace(/(^(\s)+)|((\s)+$)/g, "");
                     } else {
                         return css;

-- 
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