plugins
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
plugins [2021/10/01 09:06] – created witsec | plugins [2024/09/01 14:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
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. | 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 '' | ||
+ | |||
+ | <code javascript> | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | </ | ||
+ | |||
+ | 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 this JSON code you're telling Mobirise what the name of the plugin is and what files should be loaded. | ||
+ | |||
+ | === 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.1633072018.txt.gz · Last modified: 2024/09/01 14:30 (external edit)