MVC 3 System.Web.Optimization Associates a Single File

In MVC3 C #, I'm trying to use the new System.Web.Optimization JSminify and CssMinify packages (part of the .NET 4.5 platform).

I have one basic kit. On one page of my website, I want to include only one .js file for this page only. I would like it to be calculated as bundles, but it does not need to be connected.

How can I do that?

  • Also is there source and documentation available for this package?
+8
asp.net-mvc-3 bundle asp.net-optimization
source share
1 answer

I think you need to add another package.

For example:

Bundle myJSBundle = new Bundle("~/combined-scripts/custom/my-page", typeof(JsMinify)); myJSBundle.AddFile("~/Scripts/Custom/MyPage.js"); 

Then on your page:

 <script src="@Url.Content("~/combined-scripts/custom/my-page")" type="text/javascript"></script> 

Link: - http://www.dotnetexpertguide.com/2011/12/bundling-and-minification-aspnet-mvc4.html

Other readings:

+7
source share

All Articles