We frequently need to reference rails app assets from our Javascript. I've seen methods where you create an assets.js.erb file and you include your references to assets in there. Similar to the example here: Avoid *.js.erb files by building all the asset_path values
I think this is quite messy and I'd like to hook into manifest generation and generate a manifest.js at the same time. I came up with the following to do this https://gist.github.com/49d3f12bed298f0685a1
This works fine when you run assets:precompile, however, for development I need this manifest.js to be dynamically generated. I can't find an appropriate place to do this though. Is there some middleware that routes requests to /assets/* to /app/assets// in development mode, would it be appropriate to hook in at that stage?
Any suggestions would be welcome.