Forum: Ruby on Rails How to include & combine all controller specific javascript in rails?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6d31b173ffdfbe37ae3c6f70afcd7a49?d=identicon&s=25 deepak (Guest)
on 2013-07-30 15:43
(Received via mailing list)
Originally posted
here<http://stackoverflow.com/questions/17948417/how-to...

I am using Rails 3.2.1 where I have to include few controller and action
specific javascripts which I am doing using a
javascript_template_manager.html.haml and calling this at the bottom of
the
page. Now I want to combine all these js into one to reduce the http
request. I am using asset pipeline.

How can I combine controller specific js into one precompiled file?

Here is how my _javascript_template_manager.html.haml file looks like:

 %noscript
  :css
    #container{ display:none; }
  = render :partial => "/widgets/common/javascript_disabled"

= jquery_include_tag :google = javascript_include_tag "common"
/ condetional javascripts for the app- if params[:controller] ==
"settings"
  = javascript_include_tag "plugins/jQuery-cookie"
- if params[:controller] != "people" and params[:controller] !=
"companies"
  = javascript_include_tag "plugins/iphone-style-checkboxes"
- if params[:controller] == 'users' || params[:controller] ==
'companies'
  = javascript_include_tag "plugins/best_in_place"
- if params[:controller] == 'letters' || params[:controller] ==
'companies'
  = javascript_include_tag "plugins/jquery.autoSuggest"
- if params[:controller] == 'people' || params[:controller] == 'letters'
|| params[:controller] == 'users' || params[:controller] == 'companies'
  = javascript_include_tag "plugins/areacomplete"
= javascript_include_tag "application"

Now I want to combine all the above javascript files into one or what is
the best way to do it?

- deepak
This topic is locked and can not be replied to.