有沒有辦法在erg之外使用rails資產管道?當我撥打stylesheet_link_tag()
時,我得到一個正常的/stylesheets/
鏈接,而不是像我期望的/assets/
。我懷疑這個問題寶石只需要在資產管道中註冊一些東西,但我不確定是什麼。在ERB外使用資產管道
我用這種寶石:https://github.com/agoragames/stache
我正在使用的代碼:
module Layouts
class Application < ::Stache::View
include ActionView::Helpers::AssetTagHelper::StylesheetTagHelpers
def title
'foobar'
end
def stylesheets
[
[stylesheet_link_tag('reset', :media => 'all')]
]
end
def javascripts
end
end
end
它的產生:
<link href="/stylesheets/reset.css" media="all" rel="stylesheet" type="text/css" />
應該生成(反應都是在ERB模板):
<link href="/assets/reset.css?body=1" media="all" rel="stylesheet" type="text/css" />
使用導軌3.2.3。
你正在使用哪個版本?什麼是你到樣式表的完整鏈接?你有什麼在你的application.js –
問題更新。 – zombor