User Tools

Site Tools


plugins

This is an old revision of the document!


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"
],

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.

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 </body> tag, where a priority of 100 would make your plugin load as (one of) the first scripts. You'll have to play around with this value.

files

This is a list of one or more files you want to load or publish. Mobirise is smart enough to automatically place JavaScript files in the HTML. If you want to load images or other file types, Mobirise will simply publish them, without putting them in any HTML.

A simple example

Lorem ipsum dolor sit amet.

plugins.1633078801.txt.gz · Last modified: 2024/09/01 14:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki