Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to include & combine all controller specific javascript in rails?
    primarykey
    data
    text
    <p>I am using Rails 3.2.1 where I have to include few controller and action specific Javascripts. For which I am using a <code>_javascript_template_manager.html.haml</code> 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.</p> <p>How can I combine controller specific js into one precompiled file?</p> <p>Here is how my <code>_javascript_template_manager.html.haml</code> file looks like</p> <pre><code> %noscript :css #container{ display:none; } = render :partial =&gt; "/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" </code></pre> <p>Now I want to combine all the above javascript files into one or what is the best way to do it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload