I need to find a way to compress, version (for caching reasons), and possibly combine our JS and CSS files. I've come across two main approaches so far:
1) During the build process: Using an MSBuild task or similar. 2) Dynamically at runtime: Through a custom HTTPHandler (we are using ASP.NET), where something like the following would be included in your pages:
<link rel="stylesheet" type="text/css" href="~/StyleSheetHandler.ashx?stylesheets=~stylesheets/master.css" />
Can anyone provide insights into the pros and cons of each method? Personally, I don't see the benefit of doing it dynamically and consuming CPU resources with each request (even if it's only done once and cached afterwards), but am I overlooking something?
Thank you! Mark.