Multiple static directories definable per-plugin
-
As described here, edge versions of NodeBB support the definition of multiple static directories in a plugin. This may cause some breaking changes in future versions of NodeBB (e.g. v0.5+), but for now, they are backwards compatible.
Prior to this, static directories were defined in a plugin's
plugin.json
with this option:{ "staticDir": "assets" }
They can now be defined thusly:
{ "staticDirs": { "asdf": "first/dir", "qwerty": "second/dir" } }
If you migrate to using
staticDirs
(note the "s" ) fromstaticDir
, you'll have to update your CSS option as well, so that they are prefixed with a previously defined static directory, e.g.:{ "css": [ "qwerty/test.css", "asdf/style.css" ] }
-
Just to clarify,
staticDir
will still work just fine? -
cool .
-
Bumping. Just curious how exactly this works. For example, having:
"staticDirs": { "poll": "static" }, "css": [ "poll/css/style.css" ]
Will result in the css being loaded from
/plugins/poll/css/style.css
, which seems odd to me. How does it handle collisions?Actually I just figured it out. The staticDir you define will create the
/plugin/*dir*
path... Question about collisions remains though, it's possible that plugin developers choose the same dir name. -
@julian Ya, but @mr_waffle is right: without an plugin-identifier within the path you cannot ensure that all plugins are compatible with each other...
I'd prefer the same behavior like the old
staticDir
did for each of thestaticDirs
-entries, so I don't have to ensure that I use plugin-independent unique path-names.I don't see any negatives about the longer path-names