We are just about to start up a new quite big .NET 4.5 project and we are looking for a solution to handle our static assets such as Javascript and CSS-files. In short we want it to be a solution where it's easy to develop and debug in development environment, and maximum performance and cache control in production.
Requirements
- Must support LESS.
- Must be able to control the order of bundled JS/CSS-files.
- Must be able to bundle a subset of files in a directory, not every file.
- File hash or last modified timestamp must be appended to CSS/JS-file names as querystring (eg main.js?3B1F88A7) to break client cache on file update.
- If web.config compilation debug is set to "on" I want to include the files as separate script/link-tags to simplify development and debugging (development mode).
- If web.config compilation debug is set to "off" I want to minify and bundle the files to a single CSS/JS-file and set aggressive cache headers (production mode).
- Bundling and minification is done when the user requests the page, not a post-build script.
- Must be able to have multiple JS/CSS bundles in same website to support more than one website/different bundles on certain sub pages.
- Must support a production environment with multiple servers.
Nice to have
- It would be nice if it does not break the intellisense (CSS class names etc).
I did check out the new minification and bundling tools in .NET 4.5 (http://weblogs.asp.net/scottgu/archive/2011/11/27/new-bundling-and-minification-support-asp-net-4-5-series.aspx) and I also checked out Cassette (http://getcassette.net/) but AFAIK none of them meets all our requirements "out of the box".
So, what do you consider as best practise? Should we go with a a third party solution like Cassette, a custom built solution on the .NET 4.5 features (I like this one because it's "standard .NET", but does not support .LESS) or something completely different?
Any ideas or thoughts are welcome!