[Pkg-javascript-commits] [less.js] 240/285: load plugins from functions as well as objects
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:23:58 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 0b3acccbd2159c5b2deb10b8e344a15456f0d69a
Author: Luke Page <luke.a.page at gmail.com>
Date: Sun Oct 26 11:27:09 2014 +0000
load plugins from functions as well as objects
---
lib/less-node/plugin-loader.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/less-node/plugin-loader.js b/lib/less-node/plugin-loader.js
index bacbac0..a2a40f3 100644
--- a/lib/less-node/plugin-loader.js
+++ b/lib/less-node/plugin-loader.js
@@ -8,6 +8,11 @@ var PluginLoader = function(less) {
PluginLoader.prototype.tryLoadPlugin = function(name, argument) {
var plugin = this.tryRequirePlugin(name);
if (plugin) {
+ // support plugins being a function
+ // so that the plugin can be more usable programmatically
+ if (typeof plugin === "function") {
+ plugin = new plugin();
+ }
if (plugin.minVersion) {
if (this.compareVersion(plugin.minVersion, this.less.version) < 0) {
console.log("plugin " + name + " requires version " + this.versionToString(plugin.minVersion));
--
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