[Pkg-javascript-commits] [less.js] 121/285: move out clean css
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:23:46 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 6ea7a1995ec918b965ca92f3dfd6201373c20892
Author: Luke Page <luke.a.page at gmail.com>
Date: Wed Sep 17 15:09:04 2014 +0100
move out clean css
---
bin/lessc | 67 ++----------------------------------
lib/less-node/node-plugin-manager.js | 4 +--
lib/less/parse-tree.js | 2 +-
lib/less/plugin-manager.js | 4 +--
package.json | 1 -
5 files changed, 8 insertions(+), 70 deletions(-)
diff --git a/bin/lessc b/bin/lessc
index 50fc18f..021b4ce 100755
--- a/bin/lessc
+++ b/bin/lessc
@@ -12,7 +12,6 @@ var args = process.argv.slice(1);
var options = {
depends: false,
compress: false,
- cleancss: false,
max_line_len: -1,
silent: false,
verbose: false,
@@ -30,7 +29,6 @@ var options = {
modifyVariables: '',
urlArgs: ''
};
-var cleancssOptions = {};
var continueProcessing = true,
currentErrorcode;
@@ -114,12 +112,6 @@ args = args.filter(function (arg) {
case 'depends':
options.depends = true;
break;
- case 'yui-compress':
- warningMessages += "yui-compress option has been removed. ignoring.";
- break;
- case 'clean-css':
- options.cleancss = true;
- break;
case 'max-line-len':
if (checkArgFunc(arg, match[2])) {
options.maxLineLen = parseInt(match[2], 10);
@@ -213,40 +205,6 @@ args = args.filter(function (arg) {
options.modifyVariables += parseVariableOption(match[2]);
}
break;
- case "clean-option":
- var cleanOptionArgs = match[2].split(":");
- switch(cleanOptionArgs[0]) {
- case "--keep-line-breaks":
- case "-b":
- cleancssOptions.keepBreaks = true;
- break;
- case "--s0":
- cleancssOptions.keepSpecialComments = 0;
- break;
- case "--s1":
- cleancssOptions.keepSpecialComments = 1;
- break;
- case "--skip-advanced":
- cleancssOptions.noAdvanced = true;
- break;
- case "--advanced":
- cleancssOptions.noAdvanced = false;
- break;
- case "--compatibility":
- cleancssOptions.compatibility = cleanOptionArgs[1];
- break;
- case "--rounding-precision":
- cleancssOptions.roundingPrecision = Number(cleanOptionArgs[1]);
- break;
- default:
- console.log("unrecognised clean-css option '" + cleanOptionArgs[0] + "'");
- console.log("we support only arguments that make sense for less, '--keep-line-breaks', '-b'");
- console.log("'--s0', '--s1', '--advanced', '--skip-advanced', '--compatibility', '--rounding-precision'");
- continueProcessing = false;
- currentErrorcode = 1;
- break;
- }
- break;
case 'url-args':
if (checkArgFunc(arg, match[2])) {
options.urlArgs = match[2];
@@ -254,8 +212,9 @@ args = args.filter(function (arg) {
break;
default:
if (!pluginManager.interpretCommandLineArgument(arg, match[2])) {
- // TODO more of an explanation
- require('../lib/less/lessc_helper').printUsage();
+ console.log("Unable to interpret argument " + arg + " - if it is a plugin (less-plugin-" + arg + "), make sure that it is installed under at the same level as less");
+ console.log();
+ require('../lib/less-node/lessc-helper').printUsage();
continueProcessing = false;
currentErrorcode = 1;
}
@@ -292,11 +251,6 @@ if (options.sourceMap === true) {
options.sourceMap = path.basename(options.sourceMapFullFilename);
}
-if (options.cleancss && options.sourceMap) {
- console.log("the cleancss option is not compatible with sourcemap support at the moment. See Issue #1656");
- return;
-}
-
if (! input) {
console.log("lessc: no input files");
console.log("");
@@ -378,21 +332,6 @@ 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-node/node-plugin-manager.js b/lib/less-node/node-plugin-manager.js
index 547d0c7..465570a 100644
--- a/lib/less-node/node-plugin-manager.js
+++ b/lib/less-node/node-plugin-manager.js
@@ -9,7 +9,7 @@ NodePluginManager.prototype = new PluginManager();
NodePluginManager.prototype.interpretCommandLineArgument = function(name, argument) {
var plugin = this.tryRequirePlugin(name);
if (plugin) {
- this.addPlugin(plugin);
+ this.addPlugin(plugin, argument);
return true;
}
return false;
@@ -21,7 +21,7 @@ NodePluginManager.prototype.tryRequirePlugin = function(name) {
catch(e) {
}
try {
- return require("../../../less-plugin-"+name);
+ return require("../../../less-plugin-" + name);
}
catch(e) {
}
diff --git a/lib/less/parse-tree.js b/lib/less/parse-tree.js
index b7531b8..7788ce0 100644
--- a/lib/less/parse-tree.js
+++ b/lib/less/parse-tree.js
@@ -50,7 +50,7 @@ ParseTree.prototype.toCSS = function(options) {
for(var i = 0; i < postProcessors.length; i++) {
// TODO - pass source maps
// TODO - async
- css = postProcessors.process(css);
+ css = postProcessors[i].process(css);
}
}
return css;
diff --git a/lib/less/plugin-manager.js b/lib/less/plugin-manager.js
index 38bdb96..a093aa4 100644
--- a/lib/less/plugin-manager.js
+++ b/lib/less/plugin-manager.js
@@ -6,8 +6,8 @@ var PluginManager = function(less) {
this.visitors = [];
this.postProcessors = [];
};
-PluginManager.prototype.addPlugin = function(plugin) {
- plugin.install(this.less, this);
+PluginManager.prototype.addPlugin = function(plugin, options) {
+ plugin.install(this.less, this, options);
};
PluginManager.prototype.addVisitor = function(visitor) {
this.visitors.push(visitor);
diff --git a/package.json b/package.json
index ff44cfb..c3022d2 100644
--- a/package.json
+++ b/package.json
@@ -44,7 +44,6 @@
"mime": "~1.2.11",
"request": "~2.40.0",
"mkdirp": "~0.5.0",
- "clean-css": "2.2.x",
"source-map": "0.1.x",
"promise": "~5.0.0"
},
--
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