我在Rails 4中度过了一段艰难的时光。
我有人正在努力帮助我将一个包裹引导主题集成到我的Rails 4应用程序中。
部分提升解决方案是将我的app/assets/stylesheets
个文件重命名为profiles.scss.erb
(以前只是profiles.scss
)。在我的application.scss
中,我然后导入@import "<%= asset_path("profiles.scss") %>";
(与我的所有其他只是命名文件的导入而不是ruby标记中的路径相反)。
在开发模式下一切正常。
当我尝试推动时,我收到一条错误消息:
Precompiling assets failed.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
确定为问题的第一行是:
Sass::SyntaxError: File to import not found or unreadable: /assets/profiles.scss.
有没有人遇到过这个问题?知道如何帮助解决它吗?
答案 0 :(得分:1)
根据sass rails资产助手asset-path("rails.png") returns "/assets/rails.png"
,因此在您的情况@import "<%= asset_path("profiles.scss") %>"
中,它会在assets/profiles.scss
中查找该文件,而这不是profiles.scss.erb
的正确路径}。
要导入scss.erb
个文件,您可以使用scss
执行与其他@import "profiles"
文件相同的操作,并返回assets/stylesheets/profiles.scss.erb