rails使用bootstrap
在Gemfile文件中添加'bootstrap-sass',再运行bundle install
gem 'bootstrap-sass'
在config/application.rb添加一行代码,让bootstrap-sass和asset pipeline兼容
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de # Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
#让bootstrap-sass和asset pipeline兼容
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
end
要使用bootstrap还需要在app/assets/stylesheets目录下创建一个css文件:custom.css.scss
内容为:
@import "bootstrap-sprockets"
@import "bootstrap"
另外在app/assets/javascripts/application.js文件中添加一行
//= require bootstrap
这样才能使用bootstrap的javascript的组件。
现在就可以开始使用bootstrap了。
rails使用bootstrap的更多相关文章
- 【转】Rails中Bootstrap的安装和使用
转自:http://blog.csdn.net/lissdy/article/details/9195651 眼看着前端攻城师们都开始使用Bootstrap创作网页,于是也想学着在最近正在学习的 ...
- rails引入bootstrap
1.在Gemfile中增加 gem 'bootstrap-sass', '~> 3.2.0.2'2.bundle install3.把assets/stylesheets/application ...
- 【转】Rails 4中使用 Bootstrap 3
转自:http://rvg.me/2013/11/using-bootstrap-3-with-rails-4/ If you are looking to use Bootstrap 3 with ...
- 在Rails中最方便集成使用Bootstrap的方式
创建项目 rails new BootstrapProject 创建模型 rails g scaffold xxx --skip-stylesheets 运行迁移 rake db:migrate -- ...
- rails bug
variable @fontAwesomeEotPath_iefix is undefined rails generate bootstrap:install如果还有错,保证在加载主提之前impor ...
- rails scaffold生成的crud显示自定义的列名
1. 访问 rails i18n 插件的官方网站 ,查看信息http://guides.rubyonrails.org/i18n.html2. 在Gemfile 中加入 测试rails4.2.1不用 ...
- 软件工程资料 - UCSD 怎么教软件工程
2012年,在上软件工程课的过程中,收集到这个博客,作为学习资料. 原网站 (http://www.arc-trooper.com)已经不存在,这是一个备份. ----------------- 以下 ...
- ror笔记2
在rails app的 config 文件夹中新建unicorn.rb内容如下 worker_processes 2 working_directory "/home/mage/boleht ...
- 推荐一个有趣的Chrome扩展程序-查看任意网站的开发技术栈
对于前端开发人员来说,目前的前端框架层出不穷,最受欢迎的莫过于所谓的前端框架三驾马车:Angular, React和Vue.在学习的过程中,肯定好奇现在的互联网公司的网站用的何种前端框架来开发的. C ...
随机推荐
- rabbitMQ的使用
介绍 一款消息队列数据库,类似redis发布订阅,但是rq 做了功能完善和数据持久化.在项目中,将一些无需即时返回且耗时的操作提取出来,进行了异步处理,而这种异步处理的方式大大的节省了服务器的请求响应 ...
- 洛谷 P1072 Hankson 的趣味题 || 打质数表的分解质因数
方法就是枚举,根据b0和b1可以大大减小枚举范围,方法类似这个http://blog.csdn.net/hehe_54321/article/details/76021615 将b0和b1都分解质因数 ...
- iOS中数据类型转换--遇到则记录
1.NSString转NSNumber 使用情景:CoreData存储数据,其中一个为价格,CoreData里面定义为float 用文本输入框得到的数据类型是NSString,将NSString转换成 ...
- 使用 Realm 和 Swift 创建 ToDo 应用
原文出处: HOSSAM GHAREEB 译文出处:Prayer’s blog(@EclipsePrayer) 智能手机的快速发展的同时,涌现出了很多对开发者友好的开发工具,这些工具不仅使得开发变 ...
- Centos 6.5安装MySQL-python
报错信息: Using cached MySQL-python-1.2.5.zip Complete output from command python setup.py egg_info: ...
- java中stringBuilder的用法
java中stringBuilder的用法 String对象是不可改变的.每次使用 System.String类中的方法之一时,都要在内存中创建一个新的字符串对象,这就需要为该新对象分配新的空间.在需 ...
- 你干啥的?Lombok
01.Lombok 的自我介绍 Lombok 在官网是这样作自我介绍的: Project Lombok makes java a spicier language by adding 'handler ...
- 3. UITest笔记
1. XCUIApplication *app = [[XCUIApplication alloc] init]; App为查询的入口,当界面发生变化,查询数也会随之更新. 即使是先前存储的XC ...
- Array(数组)的基本方法
1.定义:var arr=new Array ("12" , "zhang") 2.简写:var arr=[ 12 , "zhang&quo ...
- jQuery中面向对象思想实现盒子内容切换
这里主要是模拟小米官网中的首页的内容模块实现的主要动态效果 布局:采用了bootstrap框架进行布局,及其其中的字体图标 html: <!-- 内容 --> <div class= ...