plugins
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugins [2021/10/01 09:21] – [How are plugins loaded] witsec | plugins [2024/09/01 14:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 5: | Line 5: | ||
==== How are plugins loaded ==== | ==== 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 are loaded through the '' |
- | < | + | < |
+ | " | ||
" | " | ||
- | ],</ | + | ] |
+ | </ | ||
- | [this page is under construction] | + | These few lines tell Mobirise that plugins can be found in the '' |
+ | |||
+ | Having all plugins in the same directory does not get them loaded however. For that, you'll need to create a '' | ||
+ | |||
+ | ==== plugin.json ==== | ||
+ | |||
+ | Each directory that contains one or more plugins should have a '' | ||
+ | |||
+ | <code javascript> | ||
+ | [ | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | </ | ||
+ | |||
+ | Through | ||
+ | |||
+ | === name === | ||
+ | Make sure the '' | ||
+ | |||
+ | === priority === | ||
+ | The '' | ||
+ | |||
+ | === 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. | ||
+ | |||
+ | Files don't **have** to be in their own folder, but especially if you have multiple files for a plugin, it's easier to manage them by placing them in their own folder. | ||
+ | |||
+ | |||
+ | ==== When will a plugin be loaded ==== | ||
+ | |||
+ | Good question. By following the steps above you've only told Mobirise this plugin exists, but this won't get it loaded straight away. Depending on what your extensions needs, there are various ways to load a plugin. Let's start with how most plugins get loaded. | ||
+ | |||
+ | === Section tag === | ||
+ | The most common way to load a plugin is when the '' | ||
+ | |||
+ | <code html> | ||
+ | <section class=" | ||
+ | </ | ||
+ | |||
+ | That's it. Mobirise now knows you want to use this plugin in a block and will automatically do what its told to do through the '' | ||
+ | |||
+ | === condition === | ||
+ | |||
+ | There' | ||
+ | |||
+ | <code javascript> | ||
+ | [ | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | </ | ||
+ | |||
+ | If the condition is met, the plugin will be loaded. In this case you've set it to '' | ||
+ | |||
+ | It's also possible to have the plugin rely on a theme or parameter setting. For example, if your plugin should only be loaded if the " | ||
+ | |||
+ | <code javascript> | ||
+ | [ | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | </ |
plugins.1633072880.txt.gz · Last modified: 2024/09/01 14:30 (external edit)