I'm trying to create a theme in Orchard and have added some script includes in my layout:
Script.Include("//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js").AtHead();
using (Script.Head()) {
@:<script>window.jQuery || document.write('<script src="scripts/jquery-1.7.1.min.js"><\/script>')</script>
}
Script.Include("plugins.js").AtHead();
Script.Include("script.js").AtHead();
I want to load jQuery from Google CDN but have a local fallback if the CDN version can't be loaded. To achieve this I added the script block right after the jQuery script. However when looking at the generated page source, it looks like:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"
type="text/javascript"></script>
<script src="/OrchardLocal/Themes/Test/scripts/plugins.js" type="text/javascript">
</script>
<script src="/OrchardLocal/Themes/Test/scripts/script.js" type="text/javascript">
</script>
<!--[if lt IE 9]>
<script src="/OrchardLocal/Core/Shapes/scripts/html5.js" type="text/javascript">
</script>
<![endif]-->
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')
</script>
The problem is that my fallback is now after all other scripts, whereas I would like it to be right after the jQuery CDN script include.
Is there any way that I can control where Orchard renders inline script blocks?