Compressing css and js files with yuicompressor-maven-plugin
Today I started to be worried about the size of css and js files used by my current project, so I searched for some maven plugins that can do some compression on these resources for me, hopefully I found a nice one called yuicompressor-maven-plugin.
This plugin allows to compress both css and js files, you can compress all of js files into one big file and you can do the same for css files, you can also specify which files should be added as well ignored on compression step.
The following configuration worked very well for me:
[code lang="xml"]
[/code]
Now just run a maven build and the plugin will find and compress all css and js files inside target/main/webapp for you, your compressed files will have “-min.js” as filename extension. Don’t forget change the links on your pages pointing to these compressed versions.