mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Fix plugin issues
This commit is contained in:
@@ -227,7 +227,7 @@ args = args.filter(function (arg) {
|
||||
if (plugin) {
|
||||
plugins.push(plugin);
|
||||
} else {
|
||||
console.log("Unable to load plugin " + name + " please make sure that it is installed under at the same level as less");
|
||||
console.log("Unable to load plugin " + name + " please make sure that it is installed under or at the same level as less");
|
||||
console.log();
|
||||
printUsage();
|
||||
currentErrorcode = 1;
|
||||
@@ -238,7 +238,7 @@ args = args.filter(function (arg) {
|
||||
if (plugin) {
|
||||
plugins.push(plugin);
|
||||
} else {
|
||||
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("Unable to interpret argument " + arg + " - if it is a plugin (less-plugin-" + arg + "), make sure that it is installed under or at the same level as less");
|
||||
console.log();
|
||||
printUsage();
|
||||
currentErrorcode = 1;
|
||||
|
||||
@@ -12,11 +12,20 @@ PluginLoader.prototype.tryLoadPlugin = function(name, argument) {
|
||||
console.log("plugin " + name + " requires version " + this.versionToString(plugin.minVersion));
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
console.log("plugin has no min version");
|
||||
}
|
||||
if (argument) {
|
||||
plugin.setOptions(argument);
|
||||
if (!plugin.setOptions) {
|
||||
console.log("options have been provided but the plugin " + name + "does not support any options");
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
plugin.setOptions(argument);
|
||||
}
|
||||
catch(e) {
|
||||
console.log("Error setting options on plugin " + name);
|
||||
console.log(e.message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports = function(environment, ParseTree, ImportManager) {
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
render(input, options)
|
||||
render.call(this, input, options)
|
||||
.then(function(css) {
|
||||
callback(null, css);
|
||||
},
|
||||
@@ -23,7 +23,7 @@ module.exports = function(environment, ParseTree, ImportManager) {
|
||||
} else {
|
||||
var context,
|
||||
rootFileInfo,
|
||||
pluginManager = new PluginManager();
|
||||
pluginManager = new PluginManager(this);
|
||||
|
||||
pluginManager.addPlugins(options.plugins);
|
||||
options.pluginManager = pluginManager;
|
||||
|
||||
Reference in New Issue
Block a user