# Bootstrap Generators
[](https://travis-ci.org/decioferreira/bootstrap-generators)
Bootstrap-generators provides [Twitter Bootstrap](http://getbootstrap.com/) generators for Rails 4 (supported Rails >= 3.1). Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites.
## Current Twitter Bootstrap version
The current supported version of Twitter Bootstrap is 3.3.4.
## Installing Gem
In your Gemfile, add this line:
gem 'bootstrap-generators', '~> 3.3.4'
Or you can install from latest build:
gem 'bootstrap-generators', git: 'git://github.com/decioferreira/bootstrap-generators.git'
Run bundle install:
bundle install
## Generators
Get started:
rails generate bootstrap:install
To overwrite files that already exist, pass the `--force` (`-f`) option.
Once you've done that, any time you generate a controller or scaffold, you'll get [Bootstrap](http://twitter.github.com/bootstrap/) templates.
### Give it a try
In Rails >= 4.1 you need to run `spring stop` so than Rails preloader knows about new templates.
rails generate scaffold post title body:text published:boolean
You can easily customize colors, grid system, fonts, and much more by editing `bootstrap-variables.[less|scss]` on your application assets folder.
## Usage
To print the options and usage run the command `rails generate bootstrap:install --help`
Usage:
rails generate bootstrap:install [options]
Options:
-e, [--template-engine=TEMPLATE_ENGINE] # Indicates when to generate template engine
# Default: erb
-se, [--stylesheet-engine=STYLESHEET_ENGINE] # Indicates when to generate stylesheet engine
# Default: scss
[--skip-turbolinks], [--no-skip-turbolinks] # Indicates when to generate skip turbolinks
Runtime options:
-f, [--force] # Overwrite files that already exist
-p, [--pretend], [--no-pretend] # Run but do not make any changes
-q, [--quiet], [--no-quiet] # Suppress status output
-s, [--skip], [--no-skip] # Skip files that already exist
Copy BootstrapGenerators default files
### Options
#### Template engines
Supported template engines:
* ERB
* Haml
* Slim
##### Haml
Add the dependency on your Gemfile:
gem 'haml-rails'
And then run:
rails generate bootstrap:install --template-engine=haml
##### Slim
Add the dependency on your Gemfile:
gem 'slim-rails'
And then run:
rails generate bootstrap:install --template-engine=slim
#### Stylesheet engines
Supported stylesheet engines:
* CSS
* SCSS
* LESS
##### SCSS
Make sure you have `sass-rails` dependency on your Gemfile:
gem 'sass-rails'
And then run:
rails generate bootstrap:install --stylesheet-engine=scss
Now you can customize the look and feel of Bootstrap.
##### LESS
Add the dependency on your Gemfile:
gem 'therubyracer', platforms: :ruby
gem 'less-rails'
And then run:
rails generate bootstrap:install --stylesheet-engine=less
Now you can customize the look and feel of Bootstrap.
#### Skip turbolinks
Run the generator with option `--skip-turbolinks` to remove turbolinks references from the generated layout.
## Assets
### Customize and extend Bootstrap
If you select LESS or SCSS as your stylesheet engine, you will get an `app/assets/stylesheets/bootstrap-variables.[less|scss]` file with all of the default variables of Bootstrap. This way you can customize the look and feel of Bootstrap without having to download any extra file.
### Javascript
Select all jQuery plugins (`app/assets/javascripts/bootstrap.js`)
//= require bootstrap
Or quickly add only the necessary javascript (Transitions: required for any animation; Popovers: requires Tooltips)
//= require bootstrap/collapse
//= require bootstrap/modal
//= require bootstrap/button
//= require bootstrap/affix
//= require bootstrap/tab
//= require bootstrap/alert
//= require bootstrap/transition
//= require bootstrap/tooltip
//= require bootstrap/popover
//= require bootstrap/scrollspy
//= require bootstrap/dropdown
//= require bootstrap/carousel
## Customizing Templates
In Rails 3.0 and above, generators don’t just look in the source root for templates, they also search for templates in other paths. And one of them is lib/templates.
Since Bootstrap Generators installs its templates under lib/templates, you can go and customize them.
## Update Bootstrap Version
To update the version of Bootstrap on this Gem you can run the following command:
rake bootstrap:update
There might be some manual changes needed after running this command. But most of the process is automatic.
## Credits
* [Twitter Bootstrap](http://getbootstrap.com)

weixin_38744375
- 粉丝: 375
最新资源
- 该项目为一个集数据抓取与展示一体的ACM队员数据系统,基于Django、python实现。.zip
- 辅助背单词软件,基于艾宾浩斯记忆曲线(其实背啥都行)的Python重构版,增加在线查词与翻译等功能.zip
- 基于C开发的命令行输入输出流重定向与实时分析工具_支持快捷按键和文本框输入实时过滤计算分析多格式结果呈现文本提示弹窗曲线表格支持批量测试和日志抓取_用于开发调试协议分.zip
- 各种有用的web api 基于Golang, Python(tornado django scrapy gevent).zip
- 华南理工大学找到卷王,基于 Python 的综测系统数据爬虫.zip
- 湖南大学(HNU)数据库系统课程大作业 ATM系统 前端基于Python的PyQt5,后端基于MySQL.zip
- (新闻爬虫),基于python+Flask+Echarts,实现首页与更多新闻页面爬取
- 基于 Flask + Requests 的全平台音乐接口 Python 版.zip
- 基于 FFmpeg ,使用 Python 开发的批量媒体文件格式转换器。.zip
- 基于 CAI 的 OneBot Python 实现.zip
- 基于 nonebot2 开发的消息交互式 Python 解释器,依赖 docker SDK.zip
- 基于 Python 3 + Django 2 开发的用于适配手机的简单 Jenkins 构建平台.zip
- Python 语言的爬楼梯问题实现-计算爬到第 n 级台阶的方法数
- 基于 Napcat, NcatBot, JMComic-Crawler-Python 的 QQ 机器人。.zip
- 基于 Python Tornado 的博客程序 (练习).zip
- 基于 Python 3.5 + Django 2.0 开发的简单个人博客.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


