Facing new challenges everyday

Compressing css and js files with yuicompressor-maven-plugin

October 13th, 2008

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"]

druidtarget

net.sf.alchim
yuicompressor-maven-plugin
0.7.1



compress




false

[/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.

Post to Twitter

No Comments »

No comments yet.

Leave a comment

:mrgreen: :neutral: :twisted: :shock: :smile: :???: :cool: :evil: :grin: :oops: :razz: :roll: :wink: :cry: :eek: :lol: :mad: :sad:
Imagem CAPTCHA

RSS feed for these comments. | TrackBack URI

Visitors Around the World

Polls

How Is My Site?

View Results

Loading ... Loading ...

Categories

Meta

Links

hosted by easy2use.net