deepak
2013-Jul-30  13:41 UTC
How to include & combine all controller specific javascript in rails?
Originally posted
here<http://stackoverflow.com/questions/17948417/how-to-include-combine-all-controller-specific-javascript-in-rails>
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 
-- 
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/efe2a576-db41-459e-9462-4cb358e33799%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.