For OC up to 3.x version i used Inline CSS and JavaScript plugin - October CMS to place inline assets in theme using {{ [ ‘assets/css/styles.css’ ]|inline }}
From version 4.x it seems not working. Does anyone found workaround for this issue?
For OC up to 3.x version i used Inline CSS and JavaScript plugin - October CMS to place inline assets in theme using {{ [ ‘assets/css/styles.css’ ]|inline }}
From version 4.x it seems not working. Does anyone found workaround for this issue?
What’s “not working”, inline filter? Twig output is escaped by default in OCv4: Release Note 39: October CMS 4.0 - Upgrade Guide - October CMS
I got file not found everytime i clear cache.
I created workaround
<style>{{ inline( 'assets/css/font.css'|theme) | raw }}</style>
In any plugin.php:
public function registerMarkupTags()
{
return [
'functions' => [
'inline' => function($assets) {
return file_get_contents($assets);
}
]
];
}
As per previously linked upgrade documentation, to retain previous behavior you can add non-escaping flag in Twig extension registration:
public function registerMarkupTags()
{
return [
'functions' => [
'inline' => function($assets) {
return file_get_contents($assets);
}
, false]
];
}
[/quote]