Twitter-bootstrap-rails:是否将Bootstrap安装到项目中? [英] Twitter-bootstrap-rails: does it install Bootstrap into a project?

查看:84
本文介绍了Twitter-bootstrap-rails:是否将Bootstrap安装到项目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我根据自述文件做所有事情,但有启动Rails应用程序时出现问题: Sprockets :: FileNotFound 并且它指向//= require twitter/bootstrap这个gem确实安装了bootstrap样式表和相应的js库,还是应该手动安装它们(使用bower或in其他方式)? 这是我的Gemfile:

I do everything according to Readme but having an issue when starting a rails app: Sprockets::FileNotFound And it points to //= require twitter/bootstrap Does this gem really install bootstrap stylesheets and corresponding js libraries or one is supposed to install them manually (with bower or in another way)? Here is my Gemfile:

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5.1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

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

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :assets do
  gem 'twitter-bootstrap-rails'
end

gem 'responders', '~> 2.1.1'
gem 'haml'

group :development, :test do
  gem 'pry-byebug'
  gem 'pry-rails'
  gem 'rspec-expectations', '~> 3.0.0'
  gem 'spring-commands-rspec'
  #gem 'guard-rspec', require: false
  gem 'rspec-rails', '~> 3.0.0'
  # Support for its syntax
  gem 'rspec-its', '~> 1.0.1'
  gem 'shoulda-matchers', '~> 3.1.1'
  gem 'factory_girl_rails'
  gem 'ffaker'
  gem "bower-rails", "~> 0.10.0"
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
  gem 'haml-rails'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

推荐答案

我之所以这么说是因为

I'd say that because group assets were dropped in Rails 4. From the docs:

Rails 4.0从Gemfile中删除了资产组.升级时,您需要从Gemfile中删除该行.您还应该更新您的应用程序文件(位于config/application.rb中):

Rails 4.0 removed the assets group from Gemfile. You'd need to remove that line from your Gemfile when upgrading. You should also update your application file (in config/application.rb):

所以不要使用它

....
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :assets do
  gem 'twitter-bootstrap-rails'
end
....

只需删除group块:

....
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'twitter-bootstrap-rails'
....

然后运行bundle install并重新启动服务器.

And then run bundle install and restart the server.

更多信息-> Rails4为什么掉落支持Gemfile中的资产"组

这篇关于Twitter-bootstrap-rails:是否将Bootstrap安装到项目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆