Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Packaging JavaScript & CSS

Tags:

javascript

css

I was tasked with figuring out how to package JavaScript and CSS into one file per each. We have a java servlet application and we use JQuery if that makes any difference. We use ant to script our builds, so easy integration with Ant would be nice. We want to do this to reduce caching issues and to reduce number of requests to the servlet.

I found few tools out there, but not sure what are pros/cons of each. Here is the list so far:

  • JAWR (http://jawr.java.net/)

  • Juicer (http://cjohansen.no/en/ruby/juicer_a_css_and_javascript_packaging_tool)

  • JSBuilder2 (http://www.sencha.com/products/jsbuilder/)

  • JSLint (http://code.google.com/p/jslint4java/) (JavaScript only)

  • Quilt (https://github.com/kitgoncharov/quilt) (JavaScript only)

Do you guys have any recommendations, warnings, advices? Or maybe a better tool/framework?

Thanks in advance!

like image 660
SpaceBear Avatar asked Jan 19 '23 13:01

SpaceBear


1 Answers

For JavaScript, the closure compiler integrates with Ant. It can concatenate and minify your JS. You can also use YUI compressor. Here's an example of using YUI compressor with Ant for JS and CSS.

like image 102
Annie Avatar answered Jan 28 '23 06:01

Annie