I suggest you ...

Improve System.Web.Optimization.Bundle

Add method to get relative path to files in bundle ("~/Scripts/file.js"). In particular it could be path, used when bundle was created (bundle.AddFile("~/Scripts/file.js"). New method very similar to System.Web.Optimization.Bundle.EnumerateFiles()

The purpose of new method (let's say "IEnumerable<string> GetFilesPath()") is changing HTML output when application in "debug" mode (the "debug" property value of the <compilation> element of the web.config file is "true"):
@helper JsBundle(string bundleUrl) {
if(HttpContext.Current.IsDebuggingEnabled) {
foreach(string filePath in BundleTable.Bundles.GetBundleFor(bundleUrl).GetFilesPath()) {
<script src="@filePath" type="text/javascript"></script>
}
}
else {
<script src="@BundleTable.Bundles.ResolveBundleUrl(bundleUrl)" type="text/javascript"></script>
}
}

23 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    resnyanskiyresnyanskiy shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    completed  ·  Howard DierkingHoward Dierking responded  · 

    fixed with debug/release support in RTM – enabled via the script helper functions Scripts.Render and Styles.Render

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base