The System.Web.Optimization namespace includes classes that support Content Delivery Networks (CDN) and the process of optimizing JavaScript and cascading style sheet (CSS) files in a website to reduce file size and improve page performance. The classes in this namespace enable developers to carry out bundling and minification tasks to optimize their JavaScript and CSS files.
Questions tagged [system.web.optimization]
81 questions
2
votes
1 answer
LESS files intermittently not being included in Bundle
In my ASP.NET MVC5 project I'm using Bundling/Minification and dotless together.
var commonCss = new StyleBundle("~/bundles/main.css").Include(
"~/CSS/global.css",
"~/CSS/header.less",
…

Curtis
- 101,612
- 66
- 270
- 352
2
votes
1 answer
Recompiling System.Web.Optimization to change Cache Headers
I want to recompile System.Web.Optimization to change the cache headers in Bundle.cs (CDN does not like the Vary header), since there appears to be no other way to override the headers. I am able to decompile the source (via Resharper), make the…

qrider
- 41
- 1
- 5
2
votes
4 answers
Bundling with MVC4.5 not working after publish
I trying to bundle scripts and styles bootstrap for my application. My debug is working But when I publish it, don't load scripts and styles.
I add a BundleConfig (BootstrapBundleConfig)
public static void RegisterBundles(BundleCollection bundles)
…

Niloo
- 1,205
- 5
- 29
- 53
2
votes
1 answer
Bundling for Multi-tenant ASP MVC Application
I am developing a multi-tenant application with ASP MVC. The tenant is identified by subdomain. I am using System.Web.Optimization for bundling and minification and BundleTransformer.Less.
The UI can be themed by applying a specific set of LESS…

Hernan
- 493
- 4
- 23
2
votes
0 answers
ASP.NET css minification fails when filter: progid:DXImageTransform.Microsoft.AlphaImageLoader is used
I am minifying a bunch of css files and one of them contains
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader
as a png-transparency fix for IE6 which causes the minification proccess to fail. Is there any workaround for this…

sdagkas
- 578
- 1
- 5
- 20
2
votes
1 answer
BundleTransformer.Less inject variables depending on context/request
We would like the use the bundling mechanism of System.Web.Optimization in combination with the Less transformer.
The problem is that the same application/server serves pages for different branded websites. So depending on the 'SiteContext' the same…

MichaelMdp
- 51
- 6
2
votes
1 answer
System.Web.Optimization cannot be used in a razor view file in a Class Library project
I am working in a modularized asp.net mvc4 project. Some views are located in a Class Library project. I already set the web.config to enable the intelligence in razor views. The @model, @Html.* and others are all working well. But when I try to…

Neil Yan
- 23
- 3
1
vote
1 answer
Set background image URL in CSS file to another site
I set a background image URL in CSS file to another site as below:
body.teaching {
background: url("http://sample.com/beijing.png") no-repeat no-repeat;
background-size: 100% 100%;
}
After I deploy to the server (e.g. www.foo.com), the URL…

James Hao
- 765
- 2
- 11
- 40
1
vote
0 answers
System.Web.Optimization StyleBundler removes space from infront of + but not - when compiling and minifying less
When using plain CSS calc in less I have to put a tilde before my calc string to stop less from calculating it, which works when doing - but does not when using +
What causes this and can I stop it from happening?
Examples:
width: calc(~"(100%) -…

jjr2000
- 547
- 8
- 20
1
vote
1 answer
How do i write a CDN fallback expression when loading a script asynchronously?
I'm setting up my jQuery bundle as follows:
var bundle = new ScriptBundle("~/bundles/jquery", "//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js");
// Path to the version of the file on your server (in case the CDN…

jdmeer
- 42
- 7
1
vote
0 answers
How to serve bundles from another application w/ ASP.NET Bundling?
My solution consists of several WebApplications who share the same static content.
I've been recently been using Microsoft ASP.NET Optimization Framework for bundeling these files.
The problem is I only have one Global.asax file where I register all…

user3466681
- 39
- 9
1
vote
2 answers
Added Bundling and Minification... When I look at the source, it still looks like it's not bundlnig and minifying
I added bundling to my MVC 3 app.
I downloaded the nugetpackage for Microsoft.Web.Optiminization.1.1.3
I added this to my Globals.asax
public static void RegisterBundles(BundleCollection bundles)
{
BundleTable.EnableOptimizations =…

Eric Brown - Cal
- 14,135
- 12
- 58
- 97
1
vote
2 answers
Installed Nuget package for System.Web.Optimization, keep getting error copying the System.Web.Optimization.xml file.. access denied
I'm implementing Minification and Bundling in my asp.net MVC3 application.
I installed the nuget package for System.Web.Optimization 1.1.3.
Now when I build it will build ok for a bit then I get this error:
Error 312 Unable to copy file
…

Eric Brown - Cal
- 14,135
- 12
- 58
- 97
1
vote
0 answers
.net JavaScript minification breaks jQuery plugin
I have a jQuery plugin that works fine when JS minification is turned off. As soon as you switch it on though a specific part of the plugin no longer works.
The plugin: Is a password strength indicator plugin, which checks the input runs through…

Jacques
- 6,936
- 8
- 43
- 102
1
vote
0 answers
Using js/css compression frameworks at both asp/aspx files
I have a website which has both asp and aspx pages. Can I use System.Web.Optimization, Combres etc frameworks for both.
Another problem is that these pages doesn't have code-behind as they are generated from the same template at deployment time.…

iMatoria
- 1,450
- 2
- 19
- 35