简体   繁体   中英

Assets precompile error and can not run production mode in passenger but webrick is ok in Rails 3

When I want to switch app from development to production.

I can run my app by (rails server or rails server -e production)

both work fine!!

But when I try to run in passenger 3.x + nginx , it shows me the following error.

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'

So I try to run

RAILS_ENV=production bundle exec rake assets:precompile

But it still failed

** 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 my css files

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;

background-color:#white; should be background-color:white; . You would only use # if you were specifying the HEX color. See Line 11 in your CSS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM