Hello,
I’m often loading assets into the system {% styles %} and {% scripts %} from plugins, pages or layouts and I want to do the same with the theme partials.
In my partial I have this setting:
function onStart()
{
$this->addCss('assets/css/styling.css');
$this->addJs('assets/js/script.js');
}
Obviously the {% styles %} comes before the partial, because it’s in the and {% scripts %} after, so the .js file is loaded and the .css is not.
If I move the {% styles %} somewhere at the end of the DOM, it loads the .css too.
Am I doing something wrong or it’s supposed to work like that when setting them in a partial?
It would be nice to be a way around this, for example, right now I want to separate the assets of a partial because it’s slowing the other pages that are using the same layout too much. I woldn’t make a new layout just for this…
I couldn’t find more information about this while searching, so if there’s already a post about this issue (not really an issue) please share!
Edit: it works as expected if the partial added in the page. It doesn’t work if partial is added in the layout. But why?