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

plugin
widget
panel

#1

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!


#2

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.


#3

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