mirror of
https://github.com/astefanutti/decktape.git
synced 2024-12-12 13:49:13 +03:00
Look for plugins relative to decktape.js script
Otherwise you have to run it from the installation directory.
This commit is contained in:
parent
513cf2c8e2
commit
7aa0fb0cff
10
decktape.js
10
decktape.js
@ -12,7 +12,7 @@ var process = {
|
||||
}
|
||||
};
|
||||
|
||||
var plugins = loadAvailablePlugins();
|
||||
var plugins = loadAvailablePlugins(phantom.libraryPath + "/plugins/");
|
||||
|
||||
var parser = require("./libs/nomnom")
|
||||
.nocolors()
|
||||
@ -111,11 +111,11 @@ page.open(options.url, function(status) {
|
||||
}
|
||||
});
|
||||
|
||||
function loadAvailablePlugins() {
|
||||
return fs.list("plugins/").reduce(function(plugins, plugin) {
|
||||
function loadAvailablePlugins(pluginPath) {
|
||||
return fs.list(pluginPath).reduce(function(plugins, plugin) {
|
||||
var matches = plugin.match(/^(.*)\.js$/);
|
||||
if (matches && fs.isFile("plugins/" + plugin))
|
||||
plugins[matches[1]] = require("./plugins/" + matches[1]);
|
||||
if (matches && fs.isFile(pluginPath + plugin))
|
||||
plugins[matches[1]] = require(pluginPath + matches[1]);
|
||||
return plugins;
|
||||
}, {});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user