Acquire Asset Path from JavaScript

前端 未结 6 1009
梦如初夏
梦如初夏 2021-02-18 16:17

I need to display images on an HTML5 canvas that are in the Rails asset pipeline, but I need to know the path for the asset from JavaScript. I\'m using js-routes for other parts

6条回答
  •  清酒与你
    2021-02-18 16:39

    I came across the same issue in Rails 4.1 and used referencing rails assets in coffeescript for images. No additional libraries needed.

提交回复
热议问题