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

前端 未结 11 1992
广开言路
广开言路 2020-12-07 07:02

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:

  • H
11条回答
  •  旧时难觅i
    2020-12-07 07:19

    Our project has handled it a number of ways but we have continued to use the YUI Compressor through our different iterations.

    We initially had a servlet handle the compression for JavaScript the first time that particular file was accessed; it was then cached. We already had a system in place to handle custom property files so we simply updated our configuration files to support enabling or disabling the compressor depending on the environment we were working in.

    Now the development environments never use compressed JavaScript for debugging purposes. Instead we handle the compression in our build process when exporting our application to a WAR file.

    Our client has never raised concerns about the compression and the developers don't notice it until they decide to debug JavaScript. So I'd say it's rather transparent with minimal, if any, side affects.

提交回复
热议问题