0

当我想将应用程序从开发切换到生产时。

我可以通过(rails server 或 rails server -e production)运行我的应用程序

两者都工作正常!

但是当我尝试在乘客 3.x + nginx 中运行时,它向我显示以下错误。

Started GET "/" for 127.0.0.1 at 2013-10-10 08:24:33 +0800
Processing by UrltestsController#index as HTML
  Rendered urltests/index.html.haml within layouts/application (6.4ms)
Completed 500 Internal Server Error in 4919ms

ActionView::Template::Error (Invalid CSS after "background-color: ": expected expression (e.g. 1px, bold), was "#white;"
  (in /Volumes/COMMON/Dropbox/rails/zeus/app/assets/stylesheets/application.css)):
    3:     %head
    4:         %meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=UTF-8'}
    5:         %title DQA Automation Tools Web Server Version
    6:         = stylesheet_link_tag 'application', :media=>'all'
    7:         = javascript_include_tag 'jquery','application'
    8:         = csrf_meta_tags
    9:         = tinymce_assets
  app/views/layouts/application.html.haml:6:in `_app_views_layouts_application_html_haml__2974668664975918893_70349045950040'
  app/controllers/urltests_controller.rb:11:in `index'

所以我试着跑

RAILS_ENV=production bundle exec rake assets:precompile

但是还是失败了

** Execute assets:precompile:primary
rake aborted!
Invalid CSS after "background-color: ": expected expression (e.g. 1px, bold), was "#white;"
  (in /Volumes/COMMON/Dropbox/rails/zeus/app/assets/stylesheets/application.css)
(sass):1738
/Volumes/COMMON/Dropbox/rails/zeus/vendor/bundle/ruby/1.9.1/gems/sass-3.2.10/lib/sass/scss/parser.rb:1147:in `expected'

/Volumes/COMMON/Dropbox/rails/zeus/vendor/bundle/ruby/1.9.1/bin/rake:23:in `load'
/Volumes/COMMON/Dropbox/rails/zeus/vendor/bundle/ruby/1.9.1/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile

grep 我的 css 文件

stylesheets/custom.css.scss
83:    background-color:#333333;

stylesheets/menu.css
7:background-color: #2f3c4c; }
11:background-color: #white;
21:background-color: white; }
38:background-color: gray;
45:background-color: #red; }
47:background-color: #2f3c4c;
57:background-color: gray;
72:background-color: gray;
85:background-color: #cce0cc; }
87:background-color: white;
91:  background-color: red;

stylesheets/scaffolds.css.scss
2:  background-color: #fff;
16:  background-color: #eee;
28:    background-color: #000;
44:  background-color: red;
54:  background-color: #f0f0f0;
62:    background-color: #c00;
4

1 回答 1

1

background-color:#white;应该是background-color:white;#只有在指定 HEX 颜色时才会使用。请参阅 CSS 中的第 11 行。

于 2013-10-10T00:38:19.260 回答