Question

This is an extract from my local.xml:

<reference name="head">
    <action method="addLinkRel">
        <rel>stylesheet</rel>
        <href>//fonts.googleapis.com/css?family=Cabin:400,600,700</href>
    </action>
    <action method="addItem">
        <type>skin_css</type>
        <name>css/custom-atf.css</name>
    </action>
    ...
</reference>

In the html source I would expect the google font link to appear before the custom-atf.css link but that is not the case. The google font link is being loaded almost last of all the scripts and css files.

Is there a specific order in which different actions in local.xml are processed?

Was it helpful?

Solution

For process order take a look at Mage_Page_Block_Html_Head:

  • getCssJsHtml()-
  • _separateOtherHtmlHeadElements(...)

I think load order is like:

  • CSS
  • JS
  • other links

I guess its not possible by default and there is no block before <?php echo $this->getCssJsHtml() ?> where you could inject it, so it seems you have to add it manually to your \template\page\html\head.phtml.

OTHER TIPS

Try this:

<reference name="head">
    <action method="addLinkRel">
        <rel>stylesheet</rel>
        <href>//fonts.googleapis.com/css?family=Cabin:400,600,700</href>
    </action>
    <action method="addItem">
        <type>skin_css</type>
        <name>css/custom-atf.css</name>
    </action>
    <action method="removeItem">
        <type>skin_css</type>
        <name>css/custom-atf.css</name>
    </action>
    <action method="addItem">
        <type>skin_css</type>
        <name>css/custom-atf.css</name>
    </action>

    ...
</reference>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top