rails使用bootstrap
2024-09-08 01:37:29
在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了。
最新文章
- postgresql查询的处理过程
- nodejs常用组件
- c#获取枚举
- HMM 自学教程(一)引言
- DICOM医学图像处理:storescp.exe与storescu.exe源码剖析,学习C-STORE请求
- URAL 1218 Episode N-th: The Jedi Tournament(强连通分量)(缩点)
- Net数值计算MathNet.Numerics类库
- ecshop被加入了黑链
- easy ui datagrid 动态绑定数据并绑定链接,进行操作
- iOS 设置代理过程
- iOS 开发中使用到的小技巧汇总
- 基于visual Studio2013解决C语言竞赛题之0405阶乘求和
- css3字体
- 配置好postfix邮件服务器之后就可以使用它来发送邮件了
- 【Java学习笔记之十九】super在Java继承中的用法小结
- 【转】ASP.NET MVC实现权限控制
- django 静态文件的配置
- RDLC报表系列--------初级报表
- ICML 2018 | 从强化学习到生成模型:40篇值得一读的论文
- markdown 语法小结
热门文章
- JAVA多线程(三) 线程池和锁的深度化
- 深入解读docker网络与kubernetes网络
- pycharm 激活码激活
- 2018 年度码云热门项目排行榜 TOP 10
- UltraEdit - 怎么显示文件标签栏和侧边栏
- 【Helvetic Coding Contest 2018】B2. Maximum Control (medium)
- 477 Total Hamming Distance 汉明距离总和
- log4go折腾
- [转]IntelliJ IDEA 自定义方法注解模板
- hihocoder offer收割编程练习赛9 B 水陆距离