找不到通过Rails的Twitter Bootstrap [英] Twitter Bootstrap not found via Rails
问题描述
我正在学习Ruby on Rails,并尝试实现Twitter Bootstrap。我知道如何使用和编辑它,就像我以前使用过的-只是没有导轨。
I´m learning Ruby on Rails and tried to implement Twitter Bootstrap. I know how to use and edit it, as I used it before - just without rails.
设置已完成,如此处建议: http://ruby.railstutorial.org/chapters/filling-in-the-layout版本= 3.2#sec-custom_css -当我阅读本书时。
Setup was done, as suggested here: http://ruby.railstutorial.org/chapters/filling-in-the-layout?version=3.2#sec-custom_css - As I read this book.
发生以下错误:找不到要导入的文件或不可读:bootstrap.scss。
,同时尝试导入 @import bootstrap
。
The following error occurs: File to import not found or unreadable: bootstrap.scss.
while trying to import @import "bootstrap"
.
这是我的gemfile:
Here is my gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby'
gem 'bootstrap-sass', '~> 2.1.1.0'
# 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'
...
我怎么办?
预先谢谢您!
What do I wrong? Thank you in advance!
编辑:
我还必须安装指南针?使用 gem服务器
检查时,我在 bootstrap-sass下找到 bootstrap-sass 2.1.1.0 [rdoc] [www]-取决于罗盘,sass -rails。
Do I have to install "Compass" aswell? When checking with gem server
I find under "bootstrap-sass" bootstrap-sass 2.1.1.0 [rdoc] [www] - depends on compass, sass-rails.
推荐答案
我只是按照您提供的链接中的说明进行操作,使用时没有问题引导程序。我只执行以下步骤:
I just followed the instruction in the link you provided and had no problem using bootstrap. I only did following steps:
1)编辑Gemfile,以便资产组看起来像:
1) edited the Gemfile so that the assets group would look like:
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass', '~> 2.1.1.0'
gem 'uglifier', '>= 1.0.3'
end
2)创建文件 app / assets / stylesheets / custom.css.scss
并放置以下行:
2) created the file app/assets/stylesheets/custom.css.scss
and placed the following line:
@import 'bootstrap';
3)生成了一个支架:
3) generated a scaffold:
rails g scaffold posts title:string body:text date:date
4)迁移了数据库:
rake db:migrate
5)启动服务器
rails s
6)访问帖子页面
http://localhost:3000/posts
您可以查看生成的视图css:
You can view the view the generated css:
http://localhost:3001/assets/custom.css
引导CSS被折叠的位置。
where the bootstrap css is folded in.
这篇关于找不到通过Rails的Twitter Bootstrap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!