I understand that this post is quite old, but I stumbled upon it while researching this problem, so I realized why not.
Not sure if this is the most elegant solution, but its work is good enough for us.
Basically I created a new block in local.xml as follows: <block type="core/template" name="prehead" template="page/html/prehead/main.phtml" />
Then just changed my main layouts (1column.phtml and friends) to hide this: <head> <?php echo $this->getBlockHtml('prehead') ?> <?php echo $this->getChildHtml('head') ?> </head>
In main.phtml add my JS, which I want to load first
<script type='text/javascript' src='<?php echo $this->getSkinUrl('js/require.js', array('_secure'=>true)); ?>'></script> <script type='text/javascript' src='<?php echo $this->getSkinUrl('js/main.js', array('_secure'=>true)); ?>'></script>
This is convenient for us, because it still allows us to change main.js depending on which page we are working on, doing something like this in local.xml :
<checkout_onestep_index translate="label"> <label>One Step Checkout</label> <block type="core/template" name="prehead" template="page/html/prehead/checkout.phtml" /> </checkout_onestep_index>
Hope this helps someone who accidentally stumbles upon this.
Ken
Ken koch
source share