完全卡住了,看书加了 gem 'bootstrap-sass',并在 config/application.rb 里添加
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif),到这一步还没有出错,然后再按照书上操作向应用程序中添加自定义的 CSS,首先要创建一个 CSS 文件:app/assets/stylesheets/custom.css.scss,然后在 custom.css.scss 文件中写入下面的代码
@import "bootstrap"。再次运行的时候就报错,显示的错误是:
Showing /Users/33kkk/ruby/rails_projects/sample_app/app/views/layouts/application.html.erb where line #5 raised:
undefined method `environment' for nil:NilClass (in /Users/33kkk/ruby/rails_projects/sample_app/app/assets/stylesheets/custom.css.scss) Extracted source (around line #5):
2 3
4<%= full_title(yield(:title)) %> 5<%= stylesheet_link_tag "application", media: "all", 6 "data-turbolinks-track" => true %> 7 <%= javascript_include_tag "application", "data-turbolinks-track" => true %> 8 <%= csrf_meta_tags %>Rails.root: /Users/33kkk/ruby/rails_projects/sample_app
第五行被红色标注,不知道是为什么,能不能帮忙解决一下一直停在这里