开发者

Ruby on Rails: Minify or Compress Javascript Files?

开发者 https://www.devze.com 2023-04-03 04:51 出处:网络
Currently there is this in my <head> <%= javascript_include_tag \'jquery-1.6.3.min\', \'jquery.form\', \'jquery.validate\', \'script\', :concat => true %>

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 co开发者_开发问答mments, 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号