Files structure
Pexip plugins have a basic folder structure that is used to allow for easy development of plugins.
In the below example, we have created a plugin with the name of <name>
. The
folder for this plugin would be laid out as follows.
📁 <name>
↳ 📁 assets
↳ 📁 css
↳ 📁 images
↳ 📄 buttonImage.svg
↳ 📁 js
↳ 📄 <name>.plugin.js
↳ 📄 <name>.plugin.package.json
A brief explanation of each of the files is below.
assets
This folder contains all of the assets for the project, this may be additional CSS or JavaScript or images to be displayed on the page.
css - this contains any additional CSS.
images - this contains any image files for the plugin, it is preferred that images are in the SVG vector format to allow for scaling between devices without loss of quality
js - this contains any additional JavaScript required
<name>
.plugin.package.json
This file is used to set up the plugin, it contains metadata to link the webapp2 project to the plugin so that it understands how to render the plugin. This file contains information such as what toolbar icons to show etc. and which platforms to show the plugin on.
For more information please refer to the <name>
section which contains an
in-depth deep dive into this file and its structure.
<name>
.plugin.js
This file contains the actual plugin code. This file contains code to enact on load and unload of the plugin as well as instantiating the plugin itself.