0

I'm trying to bundle and minify my css and js files with a MVC4 application but can't get it to work. I installed the Microsoft.Web.Optimization package making use of the package manager console.

I included the following statement in my HTML

<link rel="stylesheet" href="Styles/Layout/CSS" />

But my stylesheets are not loading. Is there anything I'm missing?

tereško
  • 58,060
  • 25
  • 98
  • 150
Andre Lombaard
  • 6,985
  • 13
  • 55
  • 96

1 Answers1

3

Assuming you've setup that bundle in BundleConfig.cs in your App_Start folder then you should just need to add this line in your _layout.cshtml:

 @Styles.Render("~/Styles/Layout/CSS") 

The path of the bundle should be the same as in the BundleConfig.cs file

If you don't have a BundleConfig.cs file then the easiest thing to do is create a new MVC application project (internet application template) and follow the example there.

Richard Dalton
  • 35,513
  • 6
  • 73
  • 91