Rails 3.2.0.rc1资产未在Heroku上显示

时间:2012-01-11 17:24:44

标签: ruby-on-rails heroku asset-pipeline ruby-on-rails-3.2

我的应用程序在本地运行,但样式表不适用于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的最后一行抱怨*/吗?它意味着在那里。如果有人有修复,那也是理想的。

application.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。当我加载网站时,很少有任何格式化。

2 个答案:

答案 0 :(得分:1)

首先,你怎么使用Rails 3.1rc5? - 大约6个月前发布的,你能不能把它升级到3.1.3这是最新版本?您可能正在解决错误(当然还有Rails安全修复程序),这些错误已经修复并且肯定会使用更新的依赖宝石。

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

答案 1 :(得分:-1)

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

*= require 'reset'
*= require 'style'
*= require 'projects'
*= require_self