Small module to provide very basic sorting ability for included head files (css and js) in Magento.
Will be most useful when including items from local.xml but can be used anywhere where the ordering of two or more files is important.
The module requires a rewrite of Mage_Page_Block_Html_Head
Three new methods have been added to Mage_Page_Block_Html_Head:
- setFirstItem - Make an item the first of its parent type (js or css) to be included
- setLastItem - Make an item the last of its parent type (js or css) to be included
- setBefore - takes two parameters and ensures that one will always be included before/after the other
<reference name="head">
<action method="setBefore">
<before>js/lib/jquery/jquery/jquery-1.8.2.min.js</before>
<target>js/lib/jquery/depends-on-jquery.js</target>
</action>
</reference>
or
<reference name="head">
<action method="setFirst">
<first>js/lib/jquery/jquery/jquery-1.8.2.min.js</first>
</action>
</reference>
or
<reference name="head">
<action method="setLast">
<last>js/lib/jquery/depends-on-jquery.js</last>
</action>
</reference>
Direct any feedback to @ddh__ / drewdhunter@gmail.com
1.0.0 Initial commit
1.1.0 Simplified Dh_ItemPosition_Block_Page_Html_Head::before. Additionally, this now ensures that the before item will always come directly before the after item