Commit 278af09b authored by David Hoksza's avatar David Hoksza
Browse files

fixed retrieval of plugin id. added build-debug npm target

parent 8c0fa2eb
......@@ -16,6 +16,8 @@ The starter-kit example uses NPM (node package manager) and Browserify (and few
* Download and install [NPM](https://nodejs.org/en/download/) if it is not yet installed on your system (try running `npm` from command line to find out)
* run `npm install` (this will create the *node_modules* directory with the required NPM modules)
* run `npm run build` to build the plugin which will be available in the *dist* directory
* run `npm run build-debug` if you want to obtained non-minified version of the compiled plugin, which can be used for
debugging the plugin in, e.g., Google Chrome DevTools
* publish the resulting *plugin.js* file somewhere where it can be accessed by Minerva (please beware that if the instance is running on HTTPS, the plugin must be also accessible through HTTPS)
For the development process you might want to have your local instance of Minerva running, so that you do not have to publish the plugin file every time you do a change. However, if you do not have a local Minerva instance, you can use command line to commit and push your plugin to, e.g., GitHub and provide Minerva address of the raw file. So for example if your GitHub repository with the plugin is [https://github.com/davidhoksza/minerva-plugins-starter-kit/](https://github.com/davidhoksza/minerva-plugins-starter-kit/) you can run
......
......@@ -6,6 +6,7 @@
"scripts": {
"build-css": "node-sass --include-path src/css src/css/styles.scss src/css/styles.css",
"build": "mkdirp dist && npm run build-css && browserify -t [ babelify --presets es2015 ] -t browserify-css src/js/index.js | uglifyjs --compress --mangle > dist/plugin.js ",
"build-debug": "mkdirp dist && npm run build-css && browserify -t [ babelify --presets es2015 ] -t browserify-css src/js/index.js > dist/plugin.js ",
"watch-js": "mkdirp dist && npm run build-css && watchify -v -t [ babelify --presets es2015 ] -t browserify-css src/js/index.js -o dist/plugin.js",
"clean": "rimraf dist"
},
......
......@@ -28,6 +28,11 @@ const register = function(_minerva) {
minervaProxy = _minerva;
pluginContainer = $(minervaProxy.element);
pluginContainerId = pluginContainer.attr('id');
if (!pluginContainerId) {
//the structure of plugin was changed at some point and additional div was added which is the container but does not have any properties (id or height)
pluginContainerId = pluginContainer.parent().attr('id');
}
console.log('minerva object ', minervaProxy);
console.log('project id: ', minervaProxy.project.data.getProjectId());
......@@ -59,7 +64,8 @@ minervaDefine(function (){
register: register,
unregister: unregister,
getName: getName,
getVersion: getVersion
getVersion: getVersion,
minWidth: 400
}
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment