-
Notifications
You must be signed in to change notification settings - Fork 77
/
readme-template.md.erb
163 lines (89 loc) · 4.47 KB
/
readme-template.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Bootstrap Generators
[![Build Status](https://travis-ci.org/decioferreira/bootstrap-generators.png?branch=master)](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 <%= bootstrap_version %>.
## Installing Gem
In your Gemfile, add this line:
gem 'bootstrap-generators', '~> <%= striped_bootstrap_generators_version %>'
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
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)
<%= javascript_bootstrap_content_code %>
## 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)