我正在尝试使用bootstrap-sass在Rails4上设置引导,我得到这个着名的错误:
> gem’bootstrap-sass’,’〜> 3.1.0“是集团外资产
>还试过一堆互联网上的其他东西 @H_301_4@我花了很多时间从其他帖子中获得不同的建议.如何系统地调试这个,如何设置bootstrap-sass? @H_301_4@P.S:
也试图让twitter-bootstrap-rails工作没有运气. @H_301_4@这里有一些文件 @H_301_4@的application.js
Sprockets::FileNotFound - couldn't find file 'bootstrap' (in app/assets/javascripts/application.js:16):@H_301_4@我试过以下: @H_301_4@> application.js中的twitter / bootstrap
> gem’bootstrap-sass’,’〜> 3.1.0“是集团外资产
>还试过一堆互联网上的其他东西 @H_301_4@我花了很多时间从其他帖子中获得不同的建议.如何系统地调试这个,如何设置bootstrap-sass? @H_301_4@P.S:
也试图让twitter-bootstrap-rails工作没有运气. @H_301_4@这里有一些文件 @H_301_4@的application.js
//= require jquery //= require jquery_ujs //= require js-routes //= require bootstrap //= require_tree . //= require bootstrap-slider@H_301_4@application.css.scss
*= require jquery.ui.core *= require jquery.ui.theme *= require_self *= require bootstrap-slider *= require_tree . *= stub active_admin */ @import "bootstrap";@H_301_4@的Gemfile
source 'https://rubygems.org' ruby '2.0.0' gem 'rails','4.0.0' gem 'sass-rails' gem 'coffee-rails',git: 'git://github.com/rails/coffee-rails.git' gem 'uglifier','>= 1.0.3' gem 'jquery-ui-rails' gem 'font-awesome-sass' gem 'less-rails' gem 'therubyracer',:platform=>:ruby #gem 'twitter-bootstrap-rails' gem 'jquery-rails' #gem 'jquery_mobile_rails' gem 'js-routes' gem 'cancan' gem 'devise' gem 'figaro' gem 'haml-rails' gem 'pg' gem 'rolify' gem 'sendgrid' gem 'simple_form' gem 'thin' gem 'rake' #To use db for storing cookies instead cookie-store gem 'activerecord-session_store',github: 'rails/activerecord-session_store' group :development do gem 'better_errors' #gem 'binding_of_caller',:platforms=>[:mri_19,:rbx] #Commenting out platforms part,because may be that's stopping this to be used on the dev machine' gem 'binding_of_caller' gem 'guard-bundler' gem 'guard-rails' gem 'guard-rspec' gem 'html2haml' gem 'quiet_assets' gem 'rb-fchange',:require=>false gem 'rb-fsevent',:require=>false gem 'rb-inotify',:require=>false # required with Rails panel chrome extension. This Gem should come after better_errors gem gem 'Meta_request' end group :development,:test do gem 'factory_girl_rails' gem 'rspec-rails' gem 'pry-byebug' gem 'pry-stack_explorer' gem 'pry-rails' gem 'pry-debugger' end group :test do gem 'capybara' gem 'database_cleaner' gem 'email_spec' end group :production do gem 'rails_12factor' end gem 'high_voltage' #Linkedin Logins gem "linkedin" gem "omniauth" gem "omniauth-linkedin" gem "omniauth-facebook" #postgres use hstore in active record #gem 'activerecord-postgres-hstore' gem 'state_machine' gem "ruby-graphviz" #payments #gem 'stripe',:git => 'https://github.com/stripe/stripe-ruby' #gem 'anjlab-bootstrap-rails',:require => 'bootstrap-rails',:github => 'anjlab/bootstrap-rails' gem 'newrelic_rpm' gem 'pgbackups-archive' gem 'pg_search' gem 'acts-as-taggable-on' #gem 'activeadmin',github: 'gregbell/active_admin' gem "activeadmin",git: "https://github.com/gregbell/active_admin" gem 'kaminari' gem 'bootstrap-slider-rails' gem 'bootstrap-sass','~> 3.1.0'
解决方法
安装引导宝石
@H_301_4@1.)添加引导宝石:
应用程序/资产/样式表/ application.css @H_301_4@Application.css将所有其他文件放在/ stylesheets目录中,并在运行应用程序时进行组合. @H_301_4@3.)创建一个新的SCSS文件(app / assets / stylesheets / bootstrap_and_customization.css.scss)
gem 'bootstrap-sass'@H_301_4@2.)了解Application.css文件
应用程序/资产/样式表/ application.css @H_301_4@Application.css将所有其他文件放在/ stylesheets目录中,并在运行应用程序时进行组合. @H_301_4@3.)创建一个新的SCSS文件(app / assets / stylesheets / bootstrap_and_customization.css.scss)
@import 'bootstrap';@H_301_4@4.)需要Bootstrap的JavaScript
... //= require jquery //= require jquery_ujs //= require bootstrap <-- //= require turbolinks //= require_tree .@H_301_4@路轨资产
group :production do gem 'rails_12factor' end@H_301_4@6.捆绑安装&重新启动服务器 @H_301_4@这应该是!