ASP.NET Web Optimization - confusion about loading order
- by Ciel
Using the ASP.NET Web Optimization Framework, I am attempting to load some javascript files up. It works fine, except I am running into a peculiar situation with either the loading order, the loading speed, or its execution. I cannot figure out which.
Basically, I am using ace code editor for javascript, and I also want to include its autocompletion package. This requires two files.
/ace.js
/ext-language_tools.js
This isn't an issue, if I load both of these files the normal way (with <script> tags) it works fine. But when I try to use the web optimization bundles, it seems as if something goes wrong.
Trying this out...
bundles.Add(new ScriptBundle("~/bundles/js") {
.Include("~/js/ace.js")
.Include("~/js/ext-language_tools.js")
});
and then in the view ..
@Scripts.Render("~/bundles/js")
I get the error
ace is not defined
This means that the ace.js file hasn't run, or hasn't loaded. Because if I break it apart into two bundles, it starts working.
bundles.Add(new ScriptBundle("~/bundles/js") {
.Include("~/js/ace.js")
});
bundles.Add(new ScriptBundle("~/bundles/js/language_tools") {
.Include("~/js/ext-language_tools.js")
});
Can anyone explain why this would behave in this fashion?