javascript - Sprockets' asset_path is not returning the digested path of an HTML asset in production. -


i've got template html , js files in assets directory, structured this:

app  - assets    - templates       - my_template.html    - javascripts      - application.js      - main.js.erb 

where application.js contains standard sprockets directive: //= require main

and main.js.erb contains reference path my_template.html: main.js.erb: // code here ... return { pathtotemplate: "<%= asset_path 'my_template.html' %>" } // more code here ...

in development, works great. main.js.erb evaluated following:

// code here ... return {     pathtotemplate: "assets/my_template.html" } // more code here 

in production, assets precompiled (gzipped , whitespace removed), , fingerprint appended filename.

production main.js.erb should like:

pathtotemplate: "assets/my_template-610dd79b5bb3c20d14b81baa891fc9dd.html" 

but instead same in development.

does sprockets need configured fingerprint html files? perhaps it's bug, because it's generating manifest file fingerprinted paths, asset_path returning non-fingerprinted path in main.js.erb?

thanks help.

sprockets no longer implements asset_path - rails helper provided action view.

https://github.com/rails/rails/blob/cd0b6233ae22f6bc8407d240eb2f933ca122f86d/actionpack/lib/action_view/helpers/asset_url_helper.rb#l120

this question should answer rest of you:

ruby on rails 4 , usage of asset_path


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -