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 ...
随机推荐
- bzoj 1003: [ZJOI2006]物流运输【spfa+dp】
预处理出ans[i][j]为i到j时间的最短路,设f[i]为到i时间的最小代价,转移显然就是 f[i]=min(f[j-1]+ans[j][i]*(i-j+1)+k); #include<ios ...
- Spring boot整合redis实现shiro的分布式session共享
我们知道,shiro是通过SessionManager来管理Session的,而对于Session的操作则是通过SessionDao来实现的,默认的情况下,shiro实现了两种SessionDao,分 ...
- Linux下rpm、yum和源码三种安装方式详细介绍
第1章 源码安装 源码包安装会比RPM包安装慢,是因为RPM的软件包是根据特定系统和平台而指定的,经常一种 程序会提供很多RPM包的格式,用户根据系统情况选择适合的RPM包直接安装,而源码包相当于 通 ...
- spring mvc No mapping found for HTTP request with URI [/web/test.do] in DispatcherServlet with name 'spring'
原因: spring-servlet.xml 中 <context:component-scan base-package="com.test.controller" /&g ...
- Magic Numbers CodeForces - 628D
Magic Numbers CodeForces - 628D dp函数中:pos表示当前处理到从前向后的第i位(从1开始编号),remain表示处理到当前位为止共产生了除以m的余数remain. 不 ...
- imagettftext
ImageTTFText 写 TTF 文字到图中. 语法: array ImageTTFText(int im, int size, int angle, int x, int y, int col, ...
- 使用 Realm 和 Swift 创建 ToDo 应用
原文出处: HOSSAM GHAREEB 译文出处:Prayer’s blog(@EclipsePrayer) 智能手机的快速发展的同时,涌现出了很多对开发者友好的开发工具,这些工具不仅使得开发变 ...
- 让搜狗输入法更符合编程/vim使用的配置
1. “菜单”—“设置属性”—“常用”—“初始状态”里的“中/英文”选项,选中“英文” 2. 设置属性里的“高级”里的“高级模式”,点“英文输入法设置”,“启动时启用英文输入法”选中 3. 按键-中英 ...
- nodejs on raspi
一. https://cnodejs.org/topic/54032efa9769c2e93797cd06 其中的 “安装Node.js” 一节 注意事项: 1. 它用的是v0.10.26(很早的版本 ...
- 在线编译器Coding Ground
http://www.tutorialspoint.com/codingground.htm Free Online IDE and Terminal - Edit, Compile, Execute ...