Search code examples
ruby-on-railsruby-on-rails-3includeinclude-path

Include javascript from vendor/assets/javascripts


How do you include a javascript file located in vendor/assets/javascripts in a single view file (NOT in application.js) ?

Some kind of javascript_include_tag ? Please help me with syntax

I have tried the following and it doesn't work:

  • javascript_include_tag 'respond'
  • javascript_include_tag 'respond.js'
  • javascript_include_tag 'vendor/assets/javascripts/respond'
  • javascript_include_tag 'vendor/assets/javascripts/respond.js'

Thank you


Solution

  • <%= javascript_include_tag "your_file" %>
    

    If you're trying to include respond.js, you could check out the respond_rails gem, which will allow you to include this in your view:

    <%= respond_include_tags %>
    

    In your views of course