How to inline plugin-assets correctly?

In production I want to inline some assets (css/js) of some plugins. Currently I am doing this like:

<style><?= f::read('site/plugins/imageset/assets/css/imageset.min.css'); ?></style>

Because this is the complete path in my site-folder and not the normal one I would use for Kirby’s css function I am wondering if this is best practice or not? And if there are maybe security / other concerns using the f::read function.

Thanks as always!

I’d do it like this:

<style><?= f::read(kirby()->roots()->plugins() . '/plugins/assets/css/styles.css') ?></style>
1 Like