This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I am trying to load my variables stylesheet first above everything else. In what order do stylesheets get called between the pages/layouts/partials etc and how can I best practice call my stylesheets?
For example, in the "code" tab of my {% Meta %} partial I have:
function onStart() { $this->addCss('assets/css/var.css'); }
And on my home page {% page %} I have the {% Meta %} called in the markup tab (html) and then in the code tab:
function onStart() { $this->addCss('assets/css/Pages/home.css'); }
So basically, I would like to load my var and general stylesheets first and the "homepage" stylesheet last. But, as I currently have it, it loads the homepage stylesheet first. How can I load them in the correct order?
Last updated
@Coding Crafter
The onStart event is fired before any template code is read, which is why home.css is being added first. In this instance, you would need to add a <link> tag pointing to the home.css file directly underneath the {% Meta %} partial.
Last updated
BennoThommo said:
@Coding Crafter
The
onStartevent is fired before any template code is read, which is whyhome.cssis being added first. In this instance, you would need to add a<link>tag pointing to thehome.cssfile directly underneath the{% Meta %}partial.
That's what I was thinking, but also isn't that a lesser way to load stylesheets? I was thinking about how wordpress uses the action "enqueue" which would appear to me as a similar concept as octobers "onstart"...am I correct in thinking that? I suppose it's only one stylesheet so I am making it a bigger deal than it really is, since I am only really customizing the home page.
Thanks benno.
1-3 of 3