How do you automate Javascript minification for your Java web applications?

gustafc picture gustafc · Sep 4, 2009 · Viewed 70.2k times · Source

I'm interested in hearing how you prefer to automate Javascript minification for your Java web apps. Here are a few aspects I'm particularly interested in:

  • How does it integrate? Is it part of your build tool, a servlet filter, a standalone program post-processing the WAR file, or something else?
  • Is it easy to enable and disable? It's very unfunny to try and debug a minified script, but it's also useful for a developer to be able to test that the minification doesn't break anything.
  • Does it work transparently, or does it have any side effects (apart from the ones inherent in minification) that I have to consider in my day-to-day work?
  • Which minifier does it use?
  • Does it lack any features that you can think of?
  • What do you like about it?
  • What don't you like about it?

This will mostly serve as a reference for my future projects (and hopefully other SOer's will find it informative, too), so all kinds of tools are interesting.

(Note that this is not a question about which minifier is best. We have plenty of those around already.)