0

我的应用程序在本地工作,但样式表在 Heroku 上不起作用。我很难理解为什么。

我正在使用 Heroku 的 Cedar 堆栈。

我的想法之一是我的资产没有成功预编译:

RAILS_ENV=production bundle exec rake assets:precompile

rake aborted!
Invalid CSS after "*/": expected "}", was ""
  (in /path/to/app/assets/stylesheets/application.css)

谁能解释为什么预编译*/在 application.css 的最后一行抱怨?它应该在那里。如果有人有修复,那也是理想的。

应用程序.css

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require reset
 *= require style
 *= require projects
 *= require_self
*/

更新 我试图在我的 application.css 中添加引号,但这并没有什么不同。我猜有些地方不对劲。但我无法预编译发送到heroku。当我加载网站时,几乎没有任何格式。

4

2 回答 2

1

首先,您为什么使用 Rails 3.1rc5?- 差不多 6 个月前发布的,你能不能把它升级到最新版本的 3.1.3?您可能正在与已经修复的错误(当然还有 Rails 安全修复)作斗争,并且肯定会使用更新的依赖 gem。

您的语法对于清单文件完全正确(请参阅http://guides.rubyonrails.org/asset_pipeline.html) - 问题也可能出在您需要的文件中,因此错误可能被误报。您可以通过删除一些或尝试预编译并查看它是否成功的要求语句来尝试消除过程,然后读取它们以找到麻烦的文件?

于 2012-01-11T23:21:48.453 回答
-1

我很确定您需要引用您的文件:

*= require 'reset'
*= require 'style'
*= require 'projects'
*= require_self
于 2012-01-11T17:28:06.490 回答