【发布时间】:2021-03-10 23:13:36
【问题描述】:
我有文件 app/assets/stylesheets/themes/plexa/home.sass
-
添加到 config/manifest.js
//= 链接主题/plexa/home.css
-
检查
http://localhost:3000/assets/themes/plexa/home.css- 它有效,我看到了 css! -
但如果我添加到 rails 布局:
stylesheet_link_tag "themes/plexa/home"这不行!
它引发 rails 异常:ActionView::Template::Error at / 主题/plexa/home.css
用调试器试过:
byebug) stylesheet_link_tag "themes/plexa/home"
*** Sprockets::Rails::Helper::AssetNotPrecompiled Exception: themes/plexa/home.css
我阅读了所有 sprockets 文档和升级指南,但不明白为什么 stylesheet_link_tag 不起作用(Rails 5.1)
更新: = stylesheet_link_tag "/assets/themes/plexa/home" 有效,但我不明白为什么需要设置资产路径?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-5 sprockets