CHAPTER 26

image

Bundles

In this chapter, I am going to look at the bundles feature, which the MVC Framework provides to organize and optimize the CSS and JavaScript files that views and layouts cause the browser to request from the server. Table 26-1 provides the summary for this chapter.

Table 26-1. Chapter Summary

Problem

Solution

Listing

Define bundles

Create instances of the StyleBundle and ScriptBundle classes and add them to the bundle table.

1–6

Prepare an application for bundles

Ensure that the Views/web.config file includes a reference for the System.Web.Optimization namespace.

7

Add a bundle to a view or layout

Use the Styles.Render ...

Get Pro ASP.NET MVC 5, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.