问题
I have a script my_pub_script.js.coffee
written with coffeescript
and I want to make it public so anybody can download it on example.com/scripts/my_pub_script.js
I can put any files in /public
but this is coffee
and I had to pass it through asset pipeline to properly compile it to js
.
But if I compile my script it will have a name with fingerprint suffix like my_pub_script-e55bd5e3eb82fa4e8034af2883dc37e8.js
so I don't know the current link to it.
Sure I have many other files that I want to pass through assets pipeline normally.
How I can make a static route to some coffeescript asset?
回答1:
In rails '>= 3.1.1, < 4.0.0'
there was both digest and non-digest versions of every assets in result of rake assets:precompile
.
In rails '>= 4.0.0'
according to this we have only digest versions without any possibility to get non-digest assets.
Now we have several solutions. I prefer to use the gem non-stupid-digest-assets
which adds non-digest versions of assets for rake assets:precompile
.
回答2:
Fingerprinting is enabled by default for production and disabled for all other environments. You can enable or disable it in your configuration through the config.assets.digest
option.
So in production.rb file, just do,
config.assets.digest = false
So, your problem will be resolved. But, if you want the above file only without finger printing, I'm not having the answer.
for more details about fingerprinting, please refer here
Hope that helps you..
来源:https://stackoverflow.com/questions/19703468/static-url-to-asset