0

運行後命令compass install bootstrap - > NoMethodError on line [「32」] ... sass-rails-3.2.6/lib/sass/rails/helpers.rb:未定義方法`[]'爲零:NilClass

compass install bootstrap 

我得到這個消息:

identical sass/styles.scss 

...

identical javascripts/bootstrap-typeahead.js 
NoMethodError on line ["32"] of /Users/xxx/.rvm/gems/[email protected]/gems/sass-rails-3.2.6/lib/sass/rails/helpers.rb: undefined method `[]' for nil:NilClass 
Run with --trace to see the full backtrace 

在/Users/xxx/.rvm/gems/[email protected] /gems/sass-rails-3.2.6/ LIB /上海社會科學院/導軌/ helpers.rb

31  def resolver 
32  options[:custom][:resolver] 
33  end 

我想一個解決辦法 - >https://gist.github.com/castus/4044953

def resolver 
    if ::Rails::env == "production" 
    options[:custom][:resolver] 
    else 
    Resolver.new(CompassRails.context) 
    end 
end 

&仍然沒有運氣:)

我有這個東西在我的配置/指南針。 rb

require 'bootstrap-sass' 

而我的寶石文件

source 'http://rubygems.org' 

gem "paperclip" 
gem 'bootstrap-sass', '~> 2.3.1.0' 
gem 'compass-rails' 
gem 'bootswatch-rails' 

gem 'gmaps4rails' 

gem 'rails', '3.2.13' 
gem 'activerecord-postgresql-adapter' 
gem 'devise' 
gem 'sass-rails', '~> 3.2.3' 
gem "haml" 
gem "haml-rails" 

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

# 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' 

    # See https://github.com/sstephenson/execjs#readme for more supported runtimes 
    # gem 'therubyracer', :platforms => :ruby 

    gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails' 

# To use ActiveModel has_secure_password 
# gem 'bcrypt-ruby', '~> 3.0.0' 

# To use Jbuilder templates for JSON 
# gem 'jbuilder' 

# Use unicorn as the app server 
# gem 'unicorn' 

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger 
# gem 'debugger' 

回答

1

如果您使用Rails和Bootstrap-sass,則根本不需要「指南針」。指南針適用於不使用Rails的網站。

下面是步驟來安裝和引導,青菜

  1. 它添加到Gemfile中和bundle install

  2. 重命名application.css到application.css.scss

  3. 中刪除所有評論application.css.scss,使其變爲空白

  4. 添加@import bootstrap

你完成了!將其視爲正常的css文件,並使用@import來做任何你喜歡的事情。但沒有更多require在評論!

+0

謝謝:) 我只想確認一下。在安裝Bootstrap-sass之後,我可以使用所有這些東西(http://compass-style.org/reference/compass/)嗎? – whitesiroi

+1

@whitesiroi,你提到的是Compass的CSS框架。你已經有了一個CSS框架 - Twitter引導。一起使用兩個是不必要的,並且會有衝突。 –

+0

非常感謝:) – whitesiroi

相關問題