Inline CSS and JS


In Kirby 2 I can display inline CSS and JS with:

<style><?php echo (new Asset(‘assets/css/main.min.css’))->content() ?></style>

<script><?php echo (new Asset(‘assets/js/main-min.js’))->content() ?></script>

With Kirby 3 how I can achieve this?

<style><?php echo (new Asset('assets/css/index.css'))->read() ?></style>

Make sure to use the latest release 3.0.2.


Thanks :slight_smile:

… but content() still seems the same according to the reference, doesn’t it?

This refers to a $file object, but not an Asset. In K2 the Asset class inherited from the Media class that had a content() method. In K3 that is not the case.

Thanks for clearing this up!