Load dependency in the Kirby panel before `</body>`

Hello!

Is it possible to load some library at the end of the panel <body>? I am creating a plugin with a widget that would be much easier to make if I use Vue.js, but I don’t want to put the script tag for it in my widget’s main PHP file because it will be inserted somewhere in the middle of the page and cause render blocking.

It would be ideal if I can put Vue’s script tag at the bottom of the <body> and my own script tag (that uses Vue) right after it. Is that possible? If not, what would be the best way to approach this?

Thanks!

I think you will have to stick with loading it from inside your plugin. You can only load custom CSS in the panel, for security reasons you cannot load Javascript in the panel.

Will it cause much of a block if it was packed and minified for production? You can also try deferred loading / async.

This is definitely not possible without modifying the core (or maybe with injecting the script).

1 Like