I’m getting ready to start on a new project and I’d like to know if there’s a way to automatically minify JavaScript on the server side, providing caching once the JavaScript has been minified once already? I could simply write a build script to accomplish this, but it’d be nice if I could "fire-and-forget" so to speak, with automatic minification. What would be the recommended route in this scenario? Should I minify my JavaScript before it goes online at the cost of time or should I look for something that’ll automatically do it for me on the serverside?
EDIT
I’ll probably be using Django, but of course, JavaScript and media is served separately from the actual "HTML"/application output.
This will all depend on what server side language you’re using. It will have nothing (so much) to do with Javascript or Css, but rather PHP, .NET, Ruby, etc.
(note: these are just some quick searches I’ve done. I don’t have any experience with any of them.)
I personally recommend NOT doing ANY of the minification / combining at run time since there is a server side performance hit that happens over and over and over again.
Above is my "Answer"
Below is my "Preference"
My preference is to use some sort of a Build Time minification / combining tool that achieves the goal once and leaves the server to just "serve".
Since I’m running Visual Studio for my IDE, my preference is to use a tool called Chirpy… the end result is a single static
site.min.jsfile and a single staticsite.min.cssfile that has everything I need. I will no longer suffer a performance hit from combining/minifying my js/css at run time.Edit
Be sure to read the comments below, as they help add to the overall concept of what the OP is looking for.
Edit
Also just found WebPutty, looks like a pretty slick tool.