Bundling AngularJS HTML pages with ASP.NET

image_6Bundling and minification are two well-known techniques used to improve the load time of your website. These are especially important for sites that use extensively JavaScript to offer better user experience. There are plenty of tools to help you do bundling and minification of JavaScript and CSS files. If you are a .NET developer you are probably very used to live inside Visual Studio and expect it to offer you everything you might think of. In ASP.NET 4.5 you can use a bundling API to define how your files will be grouped and sent to the client. The following example demonstrates the usage of this API.

Then in your page (either an ASP.NET page or a MVC view) you would invoke the rendering of these bundles by callingĀ Scripts.Render(“~/bundles/jquery”) andĀ Styles.Render(“~/bundles/css”). Continue Reading…