<pluginRepositories> <pluginRepository> <name>oss.sonatype.org</name> <id>oss.sonatype.org</id> <url>http://oss.sonatype.org/content/groups/public</url> </pluginRepository> </pluginRepositories> ... <plugin> <groupId>net.alchim31.maven</groupId> <artifactId>yuicompressor-maven-plugin</artifactId> <version>1.5.1</version> ... </plugin> ...
Compress (Minify + Ofuscate) Javascript files and CSS files using YUI Compressor from Julien Lecomte. Because Javascript compression could need time and resource, and to avoid repetitive (stupid) resources consumming at runtime, this plugin do compression of static files at compile time .
Check Javascript file with jslint
A sample output extract from my working project :
[INFO] [yuicompressor:compress] [INFO] uni-form-generic.css (4902b) -> uni-form-generic-min.css (1625b)[33%] [INFO] uni-form.css (8431b) -> uni-form-min.css (3435b)[40%] [WARNING] .../src/main/webapp/static/uni-form/js/highlighter.js:line -1:column -1:Found an undeclared symbol: i Highlighter.settings.field_class);for(i ---> = <--- 0;i<fields.length;i [INFO] highlighter.js (3213b) -> highlighter-min.js (1625b)[50%] [WARNING] .../src/main/webapp/static/uni-form/js/uni-form.jquery.js:line -1:column -1:Found an undeclared symbol: $ ;});});};$ ---> ( <--- document).ready(function (){ [INFO] uni-form.jquery.js (1261b) -> uni-form.jquery-min.js (674b)[53%] [INFO] style.css (11620b) -> style-min.css (8474b)[72%] [INFO] buttons.css (2513b) -> buttons-min.css (1227b)[48%] [INFO] grid.css (5012b) -> grid-min.css (2003b)[39%] [INFO] reset.css (1164b) -> reset-min.css (642b)[55%] [INFO] typography.css (5136b) -> typography-min.css (1800b)[35%] [INFO] print.css (1568b) -> print-min.css (631b)[40%] [INFO] screen.css (1035b) -> screen-min.css (103b)[9%] [INFO] navbar.css (653b) -> navbar-min.css (460b)[70%] [INFO] total input (46508b) -> output (22699b)[48%] [INFO] nb warnings: 2, nb errors: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1 second [INFO] Finished at: Tue Aug 28 23:40:57 CEST 2007 [INFO] Final Memory: 12M/21M [INFO] ------------------------------------------------------------------------