BowerBundlerHelperDnx |
This class contains extention methods to provide a the inclusings of CSS and JavaScript files in your views 1) @Html.HtmlCssCached("bundleName") is equivalent to @Styles.Render("~/Content/bundleName") 2) @Html.HtmlScriptsCached("bundleName") is equivalent to @Scripts.Render("~/bundles/bundleName") Whether it delivers individual files or the single minfied file that Grunt produced is defined by whether the code was compiled in DEBUG mode or not. This can be overridden on each method by the optional 'forceState' parameter. Both these methods have some small limitations: 1. These methods can do searches for files, e.g. ~/Scripts/*.js, or ~/Scripts/*/*.js However it does not support Grunt/Gulp's /**/ search all directories and subdirectories feature. It is something that could be implemented, but I left it out for now. It throws an NotImplementedException if found 2. I suspect that the .NET search and the Grunt/Gulp search might have slightly different rules. see the Note under Remarks about a search like *.js https://msdn.microsoft.com/en-us/library/wz42302f%28v=vs.110%29.aspx 3. BundlerHelper has the same problem (feature) as BundleConfig. If you change or add files to the settings.json file then you need to rebuild your application because HtmlCssCached and HtmlCssCached deliver from a static cache. You can turn off caching by setting the forceState parameter in each methods to true. Finally it is very tempting to add comments to the settings.json file. While Json.Net handles comments Grunt doesn't, and fails silently! |