【问题标题】:Rails 4 - Precompiling assets failed - unable to precompile assetsRails 4 - 预编译资产失败 - 无法预编译资产
【发布时间】:2016-05-07 02:47:22
【问题描述】:

我在 Rails 4 中度过了一段艰难的时光。

有人正在努力帮助我将 wrap bootstrap 主题集成到我的 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.

有人遇到过这个问题吗?知道如何帮助解决它吗?

【问题讨论】:

    标签: ruby-on-rails twitter-bootstrap heroku


    【解决方案1】:

    根据 sass rails assets helper 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

    【讨论】:

      猜你喜欢
      • 2014-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-17
      相关资源
      最近更新 更多