matt
matt

Reputation: 44293

Ruby on Rails: Minify or Compress Javascript Files?

Currently there is this in my <head>

<%= javascript_include_tag 'jquery-1.6.3.min', 'jquery.form', 'jquery.validate', 'script', :concat => true %>

This means Rails produces an all.js File with all js-files combined in it.

Is there some way in Rails to also minify or compress the js files? I mean like getting rid of comments, whitespace, whatever a js compressor typically does. I'm just curious because with an automated compression like this I wouldn't have to manually compress the js files each time I change something.

Any ideas on that?

Upvotes: 4

Views: 4928

Answers (1)

marcgg
marcgg

Reputation: 66436

You could do that using sprockets (by default in Rails 3.1+) or jammit

Upvotes: 4

Related Questions