Overwriting the composer template by theme if it comes from a plugin
-
Hi.
I'm using https://github.com/NodeBB/nodebb-plugin-composer-default plugin to provide nice composer for my forum. I need do some customization in this area but I won't fork this plugin due to ease of maintenance.
I tried adding compose.tpl and composer.tpl files to my theme with slight changes.
This didn't work as expected, composer still uses its own tpl files.
Is there an elegant way to overwrite these files with a theme/another plugin or am I making a mistake somewhere (the order in which the plugin are loaded or something I haven't thought about)? -
The templates in
src/views
are loaded first, and then the theme'stemplates/
folder, and lastly, and plugins' template folders.Templates loaded later in the chain are able to overwrite templates earlier in the chain.
In your case, you copied
compose.tpl
andcomposer.tpl
intosrc/views
, which caused them to be overwritten when the composer plugin loaded.You'll want to create your own plugin to overwrite those templates, and make sure that your plugin is loaded after composer-default.
You can fork
nodebb-plugin-quickstart
to get started quickly (hence the name). Just strip out everything... the plugin hooks, everything inlibrary.js
(probably), all the extra js files... just leavetemplates
inplugin.json
-
Thank you. Is there any way to force the order in which plugins are loaded? Because from what I understand it looks like this:
- Loading the base nodebb templates
- Loading my own theme
- Loading plugin templates
So if I just want to overwrite nodebb-plugin-composer-default
I need to have a guarantee that my plugin (let's call it nodebb-plugin-composer-default-overwrite) will always be loaded after it. -
Thanks. I was in this tab many times during development and I began to subconsciously ignore this big button.