Further plugin development

Serving files

See this as an example of serving files: https://github.com/saltcorn/mind-map/blob/e5e7581b355a6f443b2002b530cb5d2decea415b/index.js

You must:

Create a folder called public at the root of the plug-in repository. Any files you drop in here will be available, unrestricted (any role including public). For example https://github.com/saltcorn/mind-map/tree/e5e7581b355a6f443b2002b530cb5d2decea415b/public

Set the plugin name in the main module export. This will be part of the URL for public files. https://github.com/saltcorn/mind-map/blob/e5e7581b355a6f443b2002b530cb5d2decea415b/index.js#L915

Export headers in the main module export: https://github.com/saltcorn/mind-map/blob/e5e7581b355a6f443b2002b530cb5d2decea415b/index.js#L914 defined here: https://github.com/saltcorn/mind-map/blob/e5e7581b355a6f443b2002b530cb5d2decea415b/index.js#L35-L41. You should include the version number in the plug-in name as shown in this example. Files served with a version are served with longer cache duration and will expire when you update the version because of the different URL.

In some plug-ins you will see this being conditionally done depending on a feature flag but this is no longer necessary.