Monday, February 4, 2013

Add Twitter Bootstrap to MVC4

Unzip bootstrap files into the /Content directory.

Add the following lines to App_Start/BundleConfig.cs


bundles.Add(new StyleBundle("~/Content/bootstrap/css/bundle")
.Include("~/Content/bootstrap/css/bootstrap.css"));
bundles.Add(new ScriptBundle("~/Content/bootstrap/js/bundle")
.Include("~/Content/bootstrap/js/bootstrap.js"));


Add the following lines to View/Shared/_Layout.cshtml

@Styles.Render("~/Content/bootstrap/css/bundle")
@Scripts.Render("~/Content/bootstrap/js/bundle")

Note that jQuery must be included before the Bootstrap js-bundle.

No comments:

Post a Comment