Created
March 24, 2015 18:27
-
-
Save johngrant/f3091413b3b594ea137d to your computer and use it in GitHub Desktop.
Prototype code used to enumerate the files in a bundle at runtime then serialize to JS array the bundle or the contents based on the DEBUG symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
var includes = "[]"; | |
var bundleName = "~/bundles/agent-profile"; | |
if (!BundleTable.EnableOptimizations) | |
{ | |
var resolver = new BundleResolver(); | |
var url = resolver.GetBundleContents(bundleName).Select(s => string.Format("'{0}'", Url.Content(s))); | |
includes = "[" + string.Join(",", url) + "]"; | |
} | |
else | |
{ | |
var location = Url.Content(bundleName); | |
includes = "['" + location + "']"; | |
} | |
} | |
@section scriptloader { | |
var includes = @Html.Raw(includes); | |
$script(['@Url.Content("~/bundles/ko-js")'], 'knockout'); | |
$script.ready('knockout', function() { | |
$script(includes,'profile'); | |
$script.ready('profile', function() { | |
var profile = new nplay.controllers.profile(); | |
profile.initialize().done(function (app) { | |
window.app = app; | |
}); | |
}); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment