Questions tagged [asp.net-optimization]

Questions related to the ASP.NET Microsoft.AspNet.Web.Optimization nuGet package (System.Web.Optimization namespace), which supports bundling and minification of javascript and css files.

Project homepage: https://archive.codeplex.com/?p=aspnetoptimization

The Web optimization framework is installed via NuGet at https://nuget.org/packages/Microsoft.AspNet.Web.Optimization

Description:

The ASP.NET Web optimization framework provides services to improve the performance of your ASP.NET Web applications. Current services provided by the framework include:

bundling - combining multiple scripts or style resources together into a single resource, and thereby requiring browsers to make fewer HTTP requests

minification - making scripts or styles smaller using techniques such variable name shortening, white space elimination, etc.

Additionally, the framework has multiple extensibility points, enabling you to add new services over time.

174 questions
44
votes
8 answers

Make ASP.NET bundling specify media=screen for CSS bundle

I'm just trying out ASP.NET 4.5 bundling and minification, and ran into an issue. I've got around 10 css files, of which 2 were originally referenced in the layout using the attribute media="screen". Since the syntax for adding a css to the bundle…
43
votes
4 answers

Cassette bundles vs MVC4 bundles

I am currently working on a prototype ASP.NET MVC 3 solution that will be used as a base for several project rewrites (from web forms). One of the goals that I have is to implement some script management across application as opposed to none that we…
bushed
  • 1,050
  • 1
  • 15
  • 27
39
votes
1 answer

Async loading of javascript files using MVC4 Bundling and HTML5 async attribute

HTML5 has an async attribute for script files, to enable async loading. I can take advantage of this with my MVC4 bundling by referencing the bundle like so.
37
votes
4 answers

ASP.NET MVC4 Bundling with Twitter Bootstrap

I'm trying to use the new bundling feature in MVC 4 with Twitter bootstrap and it seems to me like the paths to the glyphicons png-files int the css get's messed up in some way. Heres my code: bundles.Add(new…
35
votes
12 answers

System.Web.Optimization and Microsoft.Web.Optimization won't load reference in vs 2012

I'm working on an MVC 4 project started in Visual Studio 2010. Right now I'm working on a machine with Visual Studio 2012 as I don't have access to the machine I was originally working on. I tried all morning to find answers, but they don't seem to…
MacSalty
  • 1,212
  • 4
  • 14
  • 21
27
votes
4 answers

How to upload bundled and minified files to Windows Azure CDN

I'm using the ASP.NET MVC 4 bundling and minifying features in the Microsoft.AspNet.Web.Optimization namespace (e.g. @Styles.Render("~/content/static/css")). I'd like to use it in combination with a Windows Azure CDN. I looked into writing a custom…
23
votes
2 answers

MVC4 Bundling Cache Headers

I want to change the cache headers sent from a bundle request. Currently it is varying by User-Agent but I don't want it to, is there a way to change the headers sent by a bundle request? After a quick look in the System.Web.Optimization assembly I…
21
votes
2 answers

How to bundle resources for ASP.NET MVC areas?

How would you do the resource bundling for asp.net mvc areas? Is this regulated by the ASP.NET MVC framework just like the AreaRegistration for routes? I could make a BundleConfig class inside the area and call this from the global BundleConfig…
Martijn B
  • 4,065
  • 2
  • 29
  • 41
20
votes
2 answers

Why does ResolveBundleUrl not work for custom folders? (MVC Beta 4)

From a brand-new ASP.NET MVC 4 Beta Web Application, I'm re-arranging my folders to match Rob Conery's VidPub.Web example Specifically, this means that the final directory structure for content looks like this VidPub.Web | ---Public | …
Jedidja
  • 16,610
  • 17
  • 73
  • 112
20
votes
3 answers

Do not minify certain files in ASP .NET MVC 4 BundleConfig

I don't want to minify all the files I use in my ASP .NET MVC 4 solution. So for example I have this in my BundleConfig.cs: bundles.Add(new StyleBundle("~/CSS/bootstrap").Include( "~/Content/Bootstrap/body.css", …
Léo Davesne
  • 2,103
  • 1
  • 21
  • 24
20
votes
8 answers

Could not load file or assembly 'WebGrease' one of its dependencies. The located assembly's manifest definition does not match the assembly reference

This issue has many solutions, please read all answers below, they might help you solve your problem too. If you find a new way to solve this, please document in your answer I am trying to add System.Web.Optimization to my ASP.NET Web Forms…
20
votes
1 answer

How to temporarily disable bundling and minification at runtime?

I need to be able to temporarily disable bundling and minification for a single request for the purpose of debugging JavaScript & CSS Issues. I would like to do this at run time by adding a parameter to the QueryString like…
20
votes
6 answers

Absolute URL in ASP bundle

I use a jQuery library for Google Maps, and it depends on the Google scripts to be loaded first. I'd like to be able to include both in the bundle as such: bundles.Add(new ScriptBundle("myfoobundle").Include( …
20
votes
2 answers

ASP.NET MVC 4 app with bundling and minification, why is minification enabled in debug mode?

I've just migrated an ASP.NET MVC 3 project to MVC 4 / .NET 4.0, and installed NuGet package Microsoft.AspNet.Web.Optimization in order to support bundling and minification of CSS and JavaScript. I've pretty much got bundling/minification working,…
aknuds1
  • 65,625
  • 67
  • 195
  • 317
19
votes
1 answer

New .NET feature bundle and minification {version} wildcard doesn't work with directories?

I have the following pice of code which runs perfectly: bundles.Add ( new ScriptBundle("~/bundles/scripts") .Include ( "~/Scripts/jquery-{version}.js" ,"~/Scripts/jquery-ui-{version}.js" …
Lu4
  • 14,873
  • 15
  • 79
  • 132
1
2
3
11 12