何か間違っているかどうかはわかりませんが、おそらく MVC4 内のバグです。どうすればこれを修正できますか?
作業シナリオ
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
ScriptBundle scriptBundle = new ScriptBundle("~/js");
string[] scriptArray =
{
"~/content/plugins/jquery/jquery-1.8.2.min.js",
"~/content/plugins/jquery/jquery-ui-1.9.0.min.js",
"~/content/plugins/jquery/jquery.validate.min.js",
"~/content/plugins/jquery/jquery.validate.unobtrusive.min.js",
"~/content/plugins/bootstrap/js/bootstrap.min.js",
};
scriptBundle.Include(scriptArray);
scriptBundle.IncludeDirectory("~/content/js", "*.js");
bundles.Add(scriptBundle);
BundleTable.EnableOptimizations = true;
}
}
@Scripts.Render("~/js")
に変換します (例: IT WORKS!)
<script src="/js?v=VeCPNK561DZp34yjmWbLrNM35Kf6gaNDl0xsMMC25BQ1"></script>
あまり機能しないシナリオ
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
ScriptBundle scriptBundle = new ScriptBundle("~/js");
string[] scriptArray =
{
"~/content/plugins/jquery/jquery-1.8.2.min.js",
"~/content/plugins/jquery/jquery-ui-1.9.0.min.js",
"~/content/plugins/jquery/jquery.validate.min.js",
"~/content/plugins/jquery/jquery.validate.unobtrusive.min.js",
"~/content/plugins/bootstrap/js/bootstrap.min.js",
};
scriptBundle.Include(scriptArray);
scriptBundle.IncludeDirectory("~/content/js", "*.js");
bundles.Add(scriptBundle);
// BundleTable.EnableOptimizations = true; // I could set it to 'false' for same result, it's false by default
}
}
@Scripts.Render("~/js")
に変換します (例: IT DOES NOT WORK!)
(nothing, couple of empty break lines)