Question

I have in rails project and a view new.html.slim:

I tried following:

= javascript('app/vendor/assets/javascripts/handelbars.runtime.js')
= javascript('../../../vendor/assets/javascripts/handelbars.runtime.js')
= javascript('./vendor/assets/javascripts/handelbars.runtime.js')

But still getting 404 Not Found for handelbars.runtime.js

What is the right path for all vendor/assets/javascripts/ libraries?

I wouldn't include handelbars.runtime.js in application.js

Update:

If I look into the path in browser:

http://localhost:3000/javascripts/vendor/assets/javascripts/handelbars.runtime.js

But I get also:

Routing Error
No route matches [GET] "/javascripts/vendor/assets/javascripts/handelbars.runtime.js"

Also just to test:

Routing Error
No route matches [GET] "/vendor/assets/javascripts/handelbars.runtime.js"  
Was it helpful?

Solution

http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#method-i-javascript_include_tag

= javascript_include_tag "handlebars.runtime"

If you put this at the end of your view it will be included in the document at that point. If you want it to be included in the head or at the bottom use the yield <symbol> functionality to achieve that. for instance if I have a <%= yield :head %> in my layout I can put the include tag call above into a content_for:

= content_for :head do
    = javascript_include_tag "handlebars.runtime"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top