Questions tagged [bundling-and-minification]

Bundling and minification are used to optimize web content by reducing the number of requests to the server and as well as the size of requested assets (such as CSS and JavaScript).

Bundling makes it easy to combine or bundle multiple files into a single file. You can create CSS, JavaScript and other bundles. Fewer files means fewer HTTP requests and that can improve first page load performance.

Minification performs a variety of different code optimizations to scripts or CSS, such as removing unnecessary white space and comments and shortening variable names to one character.

References:

  1. Bundling and Minification
  2. Adding Bundling and Minification to ASP.NET Web Forms
  3. Adding Web Optimization to a Web Pages Site
  4. Performance Implications of Bundling and Minification on Web Browsing
1258 questions
260
votes
9 answers

Bundler not including .min files

I have a weird issue with the mvc4 bundler not including files with extension .min.js In my BundleConfig class, I declare public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/Scripts/jquery") …
Fatal
  • 3,338
  • 3
  • 19
  • 15
104
votes
3 answers

MVC4 style bundle giving 403

When bundling/minification is enabled, some of my bundles seem to have an invalid URL in the browser (ending with a /), and IIS gives a 403 forbidden error, as if trying to list a folder's contents. There's no difference in the way my bundles are…
87
votes
6 answers

How to force BundleCollection to flush cached script bundles in MVC4

... or how I learned to stop worrying and just write code against completely undocumented APIs from Microsoft. Is there any actual documentation of the official System.Web.Optimization release? 'cuz I sure can't find any, there's no XML docs, and…
75
votes
15 answers

ASP.NET Bundling - Bundle not updating after included file has changed (returns 304 not modified)

I am trying out ASP.NET Bundling with ASP.NET MVC 4 application. The situation is that I want to make a CDN style service, which has JS and CSS files to which you can address from other sites with this type address:…
69
votes
4 answers

CssRewriteUrlTransform with or without virtual directory

We are using MVC Bundling in our site, CssRewriteUrlTransform makes sure that the image urls work from the dynamic bundle css file. But this only works when not using a virtual directory, i.e http://localhost/VirttualDir does not work but…
Anders
  • 17,306
  • 10
  • 76
  • 144
62
votes
2 answers

gulp minify all css files to a single file

I have gulp task script as following, // loads various gulp modules var gulp = require('gulp'); var concat = require('gulp-concat'); var minifyCSS = require('gulp-minify-css'); var autoprefixer = require('gulp-autoprefixer'); var rename =…
Dipendra Gurung
  • 5,720
  • 11
  • 39
  • 62
46
votes
3 answers

MVC Bundling and CSS relative URLs

MVC's bundling is returning the wrong URL in CSS images when using CssRewriteUrlTransform: I have an intranet application whose URL is, for example: http://usid01-srv002/MyApplication. It's in IIS's "Default Web Site". Which has the following in…
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
2 answers

Reconciling ASP.NET script bundles and source maps

Is there any way to set up the default System.Web.Optimization.ScriptBundle to generate source maps for the bundled and minified files? Is there an equivalent solution, other than having to pre-generate the bundles and source maps before each build?
Mihai
  • 2,835
  • 2
  • 28
  • 36
41
votes
4 answers

Why bundle optimizations are no longer a concern in HTTP/2

I read in bundling parts of systemjs documentation that bundling optimizations no longer needed in HTTP/2: Over HTTP/2 this approach may be preferable as it allows files to be individually cached in the browser meaning bundle optimizations are…
alisabzevari
  • 8,008
  • 6
  • 43
  • 67
40
votes
12 answers

Minification failed. Returning unminified contents

I have made my first website using MVC 5 which works fine on my local machine but when I publish it to the server some of the CSS is not minifying correctly. /* Minification failed. Returning unminified contents. (80,1): run-time error…
Whistler
  • 1,897
  • 4
  • 29
  • 50
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…
36
votes
10 answers

How to remove or identify unused packages from flutter to reduce size of the project?

I used some packages that I no longer need in my flutter project, namely the wilddog_auth and wilddog_sync, I can remove the imports from pubspec.yaml file, and my dart files (aka removing import 'package:wilddog_sync/wilddog_sync.dart' etc.) and…
35
votes
4 answers

With Webpack, is it possible to generate CSS only, excluding the output.js?

I'm using Webpack with the extract-text-webpack-plugin. In my project, I have some build scripts. One of the build scripts is supposed to bundle and minify CSS only. As I'm using Webpack for the other scripts, I found it a good idea to use Webpack…
Andre Pena
  • 56,650
  • 48
  • 196
  • 243
1
2 3
83 84