基础4 |导轨| Passenger - “*”后的CSS无效:期望“{”,“是”= require found ...“

时间:2013-05-10 14:09:22

标签: ruby-on-rails passenger zurb-foundation

我正在尝试让我的rails应用程序在乘客下运行并且遇到以下错误。

rake aborted!
Invalid CSS after " *": expected "{", was "= require found..."
  (in /home/hubtrackadmin/hubtrack.binarygeometry.net/app/assets/stylesheets/application.css)
(sass):15

我的Gemfile看起来像这样,我试着评论'not for production'组。这可能不是正确的做事方式,但我只是想尽快获得概念验证演示。如果有更正确的方法,我会全神贯注:)

source 'https://rubygems.org'
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql'
gem 'mysql2'
gem 'joosy', '1.0.0.RC4'
gem 'execjs'
gem 'therubyracer', :platforms => :ruby
# Gems used only for assets and not required
# in production environments by default.
# group :assets do
gem 'sass-rails',   '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'zurb-foundation', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
# end

我还在我的application.rb文件中添加了以下内容,以便在我的前端js文件未编译的情况下解决早期错误。

require File.expand_path('../boot', __FILE__)

require 'rails/all'


if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require(*Rails.groups(:assets => %w(development test)))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

module MyModule
  class Application < Rails::Application
    # Precompile *all* assets, except those that start with underscore
    config.assets.precompile << /(^[^_\/]|\/[^_])[^\/]*$/

我的错误跟踪如下。

bundle exec rake assets:precompile
/home/entracked/.rvm/rubies/ruby-1.9.3-p392/bin/ruby /home/entracked/.rvm/gems/ruby-   1.9.3-p392@global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Invalid CSS after " *": expected "{", was "= require found..."
  (in   /home/hubtrackadmin/hubtrack.binarygeometry.net/app/assets/stylesheets/application.css)
(sass):15
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass- 3.2.8/lib/sass/scss/parser.rb:1148:in `expected'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass-3.2.8/lib/sass/scss/parser.rb:1084:in `expected'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass-3.2.8/lib/sass/scss/parser.rb:1079:in `tok!'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass-3.2.8/lib/sass/scss/parser.rb:534:in `block'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass-3.2.8/lib/sass/scss/parser.rb:529:in `ruleset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass-3.2.8/lib/sass/scss/parser.rb:553:in `block_child'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass-3.2.8/lib/sass/scss/parser.rb:543:in `block_contents'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass-3.2.8/lib/sass/scss/parser.rb:82:in `stylesheet'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass-3.2.8/lib/sass/scss/parser.rb:27:in `parse'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass-3.2.8/lib/sass/engine.rb:342:in `_to_tree'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass-3.2.8/lib/sass/engine.rb:315:in `_render'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass-3.2.8/lib/sass/engine.rb:262:in `render'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sass-rails-3.2.6/lib/sass/rails/compressor.rb:12:in `compress'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/actionpack-3.2.13/lib/sprockets/compressors.rb:74:in `compress'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sprockets-2.2.2/lib/sprockets/processing.rb:243:in `block in css_compressor='
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `call'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `evaluate'
/home/entracked/.rvm/gems/ruby-1.9.3-p392@hub_blog/gems/tilt-1.4.0/lib/tilt/template.rb:103:in `render'

任何和所有帮助表示赞赏。

1 个答案:

答案 0 :(得分:11)

好的,找到了答案。它与此问题有关https://github.com/zurb/foundation/issues/1942

需要做的是使用application.css

 *= require_self
 *= require_tree .
 */
 *= require foundation_and_overrides
 *= require layout

您需要将结束* /标记移到最后两个要求之外,以便它们包含在清单中而不是css中。

*= require_self
*= require_tree .
*= require foundation_and_overrides
*= require layout
*/