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

前端 未结 11 1973
广开言路
广开言路 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条回答
  •  情深已故
    2020-12-07 07:36

    I think one of the best and right tool for the job is wro4j Check out https://github.com/wro4j/wro4j

    It does everything you need:

    • Keep project web resources (js & css) well organized
    • Merge & minify them at run-time (using a simple filter) or build-time (using maven plugin)
    • Free and open source: Released under an Apache 2.0 license
    • several minification tools supported by wro4j: JsMin, Google Closure compressor, YUI etc
    • Very easy to use. Supports Servlet Filter, Plain Java or Spring Configuration
    • Javascript and CSS Meta Frameworks Support: CoffeeScript, Less, Sass etc
    • Validation: JSLint, CSSLint etc

    Can run in debug as well as production modes. Just specify all the files it should handle/pre-process and it does the rest.

    You can simply include merged, minified and compressed resource like this:

    
    

提交回复
热议问题