Another quick post – a really useful feature of MVC that everyone has heard of…and then they seem to forget to do it in practice.
Don’t forget about Bundling and Minification – Rick Anderson explains here how to do it and why it’s important, and a picture tells a thousand words when you see network timings before and after switching on bundling.
Remember, if you don’t see bundling working on your MVC project:
- Make sure that the compilation element in your Web.config’s
system.web
node has thedebug = "false"
; - Check the
RegisterBundles
class and check if the BundleTable.EnableOptimizations value is set.- I don’t actually like this being in my
RegisterBundles
class – I’d prefer to set this through configuration and not have it embedded in my C# code;
- I don’t actually like this being in my
- Make sure that the bundling/minification configuration that you’ve set up for your development environment isn’t being copied across to your other environments – you might have planned to debug locally, but you probably don’t want that preference copied across to your acceptance, demonstration or production environments.
This is a really quick and simple way to improve your site’s performance – try it!