Ruby on rails 如何从生产站点的资产/图像中保存的传单中加载标记png
我的rails站点正在使用传单gem。我在开发中加载png没有问题,但是当我切换到我的生产站点时,路径现在从传单下开始 我希望通过我的网站/assets/images/找到我的路径,但在生产过程中它变成了我的网站/assets/传单/dist/images/ 我把.erb附在我的咖啡脚本上了。以及以下代码:Ruby on rails 如何从生产站点的资产/图像中保存的传单中加载标记png,ruby-on-rails,ruby-on-rails-4,coffeescript,leaflet,asset-pipeline,Ruby On Rails,Ruby On Rails 4,Coffeescript,Leaflet,Asset Pipeline,我的rails站点正在使用传单gem。我在开发中加载png没有问题,但是当我切换到我的生产站点时,路径现在从传单下开始 我希望通过我的网站/assets/images/找到我的路径,但在生产过程中它变成了我的网站/assets/传单/dist/images/ 我把.erb附在我的咖啡脚本上了。以及以下代码: digested_icon = L.icon({ iconUrl: "<%= asset_path 'marker-icon.png' %>" iconRetinaUrl
digested_icon = L.icon({
iconUrl: "<%= asset_path 'marker-icon.png' %>"
iconRetinaUrl: "<%= asset_path 'marker-icon-2x.png' %>"
shadowUrl: "<%= asset_path 'marker-shadow.png' %>"
})
sgMarker = L.marker(sgLatLng, {icon: digested_icon})
digested_icon=L.icon({
伊克努尔:“
iconRetinaUrl:“
shadowUrl:“
})
sgMarker=L.marker(sgLatLng,{icon:digested_icon})
我也尝试了asset_url,但效果相同。配置资产管道以编译.png文件(尤其是在供应商/中,因为默认情况下不会这样做):
这将允许将您的.png图像编译为public/assets/传单/dist/images/然后它们将显示在生产中。配置资产管道以编译.png文件(尤其是在供应商/中,因为默认情况下不会这样做): 这将允许您将.png图像编译为public/assets/传单/dist/images/然后它们将显示在生产中
# In config/initializers/assets.rb
Rails.application.config.assets.precompile += ["*.png"]