====== Plugins ======
Plugins are files that are required by an extension, either inside Mobirise or when published. These can be of any type, for example images or JavaScript files.
==== How are plugins loaded ====
Plugins are loaded through the ''params.json'' file. Depending on what your extension needs (and when), you can load one or more plugins. The most common way to tell Mobirise what plugins exist is to place them all in the same directory. In the example below, all plugins are in the same `plugins` directory:
"plugins": [
"plugins"
]
These few lines tell Mobirise that plugins can be found in the ''plugins'' folder.
Having all plugins in the same directory does not get them loaded however. For that, you'll need to create a ''plugin.json'' file.
==== plugin.json ====
Each directory that contains one or more plugins should have a ''plugin.json'' file to actually load them into Mobirise. Here's a little example:
[
{
"name": "plugin-name",
"priority": 3000,
"files": [
"plugin-name-or-directory/myscript.js"
]
}
]
Through this JSON code you're telling Mobirise what the name of the plugin is and what files should be loaded.
=== name ===
Make sure the ''name'' of your plugin is unique, so that it doesn't interfere with any other plugin. In the example above we've named it ''plugin-name''. If you have just one plugin for your extension, you may as well use the same name for the plugin as your extension.
=== priority ===
The ''priority'' tells Mobirise when to load the file(s). This is important when you want to make sure your plugin is loaded before or after other scripts, like jQuery or Bootstrap. A priority of 3000 or higher is likely to load somewhere near the end of the ''