How to minify and process files inside webjars?

1k views Asked by At

I just found Maven WebJars but I would like to know how to minify those files after finishing my project. I would like to use something like a maven plugin, but I haven't found anyone. It would be helpful if someone tell me one. Thanks

2

There are 2 answers

0
eugen-fried On

There could be another way to do this: create an antrun execution on phase prepare-package that simply <exec> (but it better be <javaexec> , so you can depend on it and not on the environment) your favorite minifier. That may be not the neatest way to do this, but it surely will get the thing done, and with proper generation to ${project.build.outputDirectory} (target/classes) should not interrupt normal maven workflow.

0
maheshsenni On

There is a project called Web Resource Optimizer for Java (wro4j) which supports many JS plugins (JSHint, CSSLint et al). Check this page for usage details. Google Closure compressor and YUI Compressor are supported. You can try minification using these.