Bower modules updated.
This commit is contained in:
parent
5c341e2e5a
commit
1ee78ab657
140 changed files with 7098 additions and 3713 deletions
|
@ -1,4 +1,4 @@
|
|||
# Bootstrap for Sass [](http://travis-ci.org/twbs/bootstrap-sass)
|
||||
# Bootstrap for Sass [](http://badge.fury.io/rb/bootstrap-sass) [](http://badge.fury.io/bo/bootstrap-sass-official) [](http://travis-ci.org/twbs/bootstrap-sass)
|
||||
|
||||
`bootstrap-sass` is a Sass-powered version of [Bootstrap](http://github.com/twbs/bootstrap), ready to drop right into your Sass powered applications.
|
||||
|
||||
|
@ -13,21 +13,39 @@ Please see the appropriate guide for your environment of choice:
|
|||
In your Gemfile you need to add the `bootstrap-sass` gem, and ensure that the `sass-rails` gem is present - it is added to new Rails applications by default.
|
||||
|
||||
```ruby
|
||||
gem 'bootstrap-sass', '~> 3.2.0'
|
||||
gem 'sass-rails', '>= 3.2'
|
||||
gem 'bootstrap-sass', '~> 3.1.1'
|
||||
```
|
||||
|
||||
It is also recommended to use [Autoprefixer](https://github.com/ai/autoprefixer-rails) with Bootstrap
|
||||
to add browser vendor prefixes automatically. Simply add the gem:
|
||||
|
||||
```ruby
|
||||
gem 'autoprefixer-rails'
|
||||
```
|
||||
|
||||
`bundle install` and restart your server to make the files available through the pipeline.
|
||||
|
||||
In `app/assets/stylesheets/application.css.scss`:
|
||||
|
||||
```scss
|
||||
@import "bootstrap-sprockets";
|
||||
@import "bootstrap";
|
||||
```
|
||||
|
||||
Do not use `//= require` in Sass or your other stylesheets will not be [able to access][antirequire] the Bootstrap mixins or variables.
|
||||
|
||||
In `app/assets/javascripts/application.js`:
|
||||
|
||||
```js
|
||||
//= require jquery
|
||||
//= require bootstrap-sprockets
|
||||
```
|
||||
|
||||
#### Rails 3.2.x
|
||||
|
||||
Rails 3.2 is [no longer maintained for bugfixes](http://guides.rubyonrails.org/maintenance_policy.html), and you should upgrade as soon as possible.
|
||||
|
||||
If you must use it, make sure bootstrap-sass is moved out of the `:assets` group.
|
||||
This is because, by default in Rails 3.2, assets group gems are not required in `production`.
|
||||
However, for pre-compilation to succeed in production, `bootstrap-sass` gem must be required.
|
||||
|
||||
Starting with bootstrap-sass v3.1.1.1, due to the structural changes from upstream you will need these
|
||||
backported asset pipeline gems on Rails 3.2. There is more on why this is necessary in
|
||||
https://github.com/twbs/bootstrap-sass/issues/523 and https://github.com/twbs/bootstrap-sass/issues/578.
|
||||
|
@ -53,55 +71,49 @@ require 'bootstrap-sass'
|
|||
```
|
||||
|
||||
```console
|
||||
bundle exec compass install bootstrap
|
||||
$ bundle exec compass install bootstrap
|
||||
```
|
||||
|
||||
If you are creating a new Compass project, you can generate it with bootstrap-sass support:
|
||||
|
||||
```console
|
||||
bundle exec compass create my-new-project -r bootstrap-sass --using bootstrap
|
||||
$ bundle exec compass create my-new-project -r bootstrap-sass --using bootstrap
|
||||
```
|
||||
|
||||
or, alternatively, if you're not using a Gemfile for your dependencies:
|
||||
|
||||
```console
|
||||
compass create my-new-project -r bootstrap-sass --using bootstrap
|
||||
$ compass create my-new-project -r bootstrap-sass --using bootstrap
|
||||
```
|
||||
|
||||
This will create a new Compass project with the following files in it:
|
||||
|
||||
* [_variables.scss](/templates/project/_variables.sass.erb) - all of bootstrap variables (override them here).
|
||||
* [styles.scss](/templates/project/styles.sass) - main project SCSS file, import `variables` and `bootstrap`.
|
||||
* [styles.sass](/templates/project/styles.sass) - main project Sass file, imports Bootstrap and variables.
|
||||
* [_bootstrap-variables.sass](/templates/project/_bootstrap-variables.sass.erb) - all of Bootstrap variables, override them here.
|
||||
|
||||
Some bootstrap-sass mixins may conflict with the Compass ones.
|
||||
If this happens, change the import order so that Compass mixins are loaded later.
|
||||
|
||||
### c. Ruby without Compass / Rails
|
||||
|
||||
Require the gem, and load paths and Sass helpers will be configured automatically:
|
||||
|
||||
```ruby
|
||||
require 'bootstrap-sass'
|
||||
```
|
||||
|
||||
### d. Node.js / Bower
|
||||
### c. Bower
|
||||
|
||||
Using bootstrap-sass as a Bower package is still being tested. It is compatible with node-sass 0.8.3+. You can install it with:
|
||||
|
||||
```bash
|
||||
bower install bootstrap-sass-official
|
||||
```console
|
||||
$ bower install bootstrap-sass-official
|
||||
```
|
||||
|
||||
`bootstrap-sass` is taken so make sure you use the command above.
|
||||
|
||||
Sass, JS, and all other assets are located at [vendor/assets](/vendor/assets).
|
||||
Sass, JS, and all other assets are located at [assets](/assets).
|
||||
|
||||
By default, `bower.json` main field list only the main `bootstrap.scss` and all the static assets (fonts and JS).
|
||||
This is compatible by default with asset managers such as [wiredep](https://github.com/taptapship/wiredep).
|
||||
|
||||
#### Mincer
|
||||
#### Node.js Mincer
|
||||
|
||||
If you use [mincer][mincer] with node-sass, import bootstrap into a `.css.ejs.scss` file like so:
|
||||
If you use [mincer][mincer] with node-sass, import bootstrap into like so:
|
||||
|
||||
In `application.css.ejs.scss` (NB **.css.ejs.css**):
|
||||
|
||||
```scss
|
||||
// Import mincer asset paths helper integration
|
||||
|
@ -109,47 +121,95 @@ If you use [mincer][mincer] with node-sass, import bootstrap into a `.css.ejs.sc
|
|||
@import "bootstrap";
|
||||
```
|
||||
|
||||
In `application.js`:
|
||||
|
||||
```js
|
||||
//= require bootstrap-sprockets
|
||||
```
|
||||
|
||||
See also this [example manifest.js](/test/dummy_node_mincer/manifest.js) for mincer.
|
||||
|
||||
#### Number precision
|
||||
|
||||
### Configuration
|
||||
|
||||
#### Sass
|
||||
|
||||
By default all of Bootstrap is imported.
|
||||
|
||||
You can also import components explicitly. To start with a full list of modules copy
|
||||
[`bootstrap.scss`](assets/stylesheets/bootstrap.scss) file into your assets as `bootstrap-custom.scss`.
|
||||
Then comment out components you do not want from `bootstrap-custom`.
|
||||
In the application Sass file, replace `@import 'bootstrap'` with:
|
||||
|
||||
```scss
|
||||
@import 'bootstrap-custom';
|
||||
```
|
||||
|
||||
#### Sass: Number Precision
|
||||
|
||||
bootstrap-sass [requires](https://github.com/twbs/bootstrap-sass/issues/409) minimum [Sass number precision][sass-precision] of 10 (default is 5).
|
||||
|
||||
When using ruby Sass compiler with the bower version you can enforce the limit with:
|
||||
Precision is set for Rails and Compass automatically.
|
||||
When using ruby Sass compiler standalone or with the Bower version you can set it with:
|
||||
|
||||
```ruby
|
||||
::Sass::Script::Number.precision = [10, ::Sass::Script::Number.precision].max
|
||||
```
|
||||
|
||||
Precision option is now available in libsass, but it has not made into node-sass yet.
|
||||
Note that libsass and node-sass do not currently support the precision option, due to an open bug ([bug #364](https://github.com/sass/libsass/issues/364)) in libsass.
|
||||
|
||||
#### JS and fonts
|
||||
|
||||
Assets are discovered automatically on Rails, Sprockets, Compass, and Node + Mincer, using native asset path helpers.
|
||||
#### Sass: Autoprefixer
|
||||
|
||||
Otherwise the fonts are referenced as:
|
||||
Using [Autoprefixer][autoprefixer] with Bootstrap is recommended.
|
||||
[Autoprefixer][autoprefixer] adds vendor prefixes to CSS rules using values from [Can I Use](http://caniuse.com/).
|
||||
|
||||
```sass
|
||||
#### JavaScript
|
||||
|
||||
[`assets/javascripts/bootstrap.js`](/assets/javascripts/bootstrap.js) contains all of Bootstrap JavaScript,
|
||||
concatenated in the [correct order](/assets/javascripts/bootstrap-sprockets.js).
|
||||
|
||||
|
||||
#### JavaScript with Sprockets or Mincer
|
||||
|
||||
If you use Sprockets or Mincer, you can require `bootstrap-sprockets` instead to load the individual modules:
|
||||
|
||||
```js
|
||||
// Load all Bootstrap JavaScript
|
||||
//= require bootstrap-sprockets
|
||||
```
|
||||
|
||||
You can also load individual modules, provided you also require any dependencies.
|
||||
You can check dependencies in the [Bootstrap JS documentation][jsdocs].
|
||||
|
||||
```js
|
||||
//= require bootstrap/scrollspy
|
||||
//= require bootstrap/modal
|
||||
//= require bootstrap/dropdown
|
||||
```
|
||||
|
||||
#### Fonts
|
||||
|
||||
The fonts are referenced as:
|
||||
|
||||
```scss
|
||||
"#{$icon-font-path}#{$icon-font-name}.eot"
|
||||
```
|
||||
|
||||
`$icon-font-path` defaults to `bootstrap/`.
|
||||
`$icon-font-path` defaults to `bootstrap/` if asset path helpers are used, and `../fonts/bootstrap/` otherwise.
|
||||
|
||||
When not using an asset pipeline, you can copy fonts and JS from bootstrap-sass, they are located at [vendor/assets](/vendor/assets):
|
||||
When using bootstrap-sass with Compass, Sprockets, or Mincer, you **must** import the relevant path helpers before Bootstrap itself, for example:
|
||||
|
||||
```bash
|
||||
mkdir public/fonts
|
||||
cp -r $(bundle show bootstrap-sass)/vendor/assets/fonts/ public/fonts/
|
||||
mkdir public/javascripts
|
||||
cp -r $(bundle show bootstrap-sass)/vendor/assets/javascripts/ public/javascripts/
|
||||
```scss
|
||||
@import "bootstrap-compass";
|
||||
@import "bootstrap";
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Sass
|
||||
|
||||
Import Bootstrap into a Sass file (for example, `application.css.scss`) to get all of Bootstrap's styles, mixins and variables!
|
||||
We recommend against using `//= require` directives, since none of your other stylesheets will be [able to access][antirequire] the Bootstrap mixins or variables.
|
||||
Import Bootstrap into a Sass file (for example, application.css.scss) to get all of Bootstrap's styles, mixins and variables!
|
||||
|
||||
```scss
|
||||
@import "bootstrap";
|
||||
|
@ -171,38 +231,6 @@ $navbar-default-color: $light-orange;
|
|||
@import "bootstrap";
|
||||
```
|
||||
|
||||
You can also import components explicitly. To start with a full list of modules copy this file from the gem:
|
||||
|
||||
```bash
|
||||
cp $(bundle show bootstrap-sass)/vendor/assets/stylesheets/bootstrap.scss \
|
||||
app/assets/stylesheets/bootstrap-custom.scss
|
||||
```
|
||||
Comment out components you do not want from `bootstrap-custom`.
|
||||
|
||||
In `application.sass`, replace `@import 'bootstrap'` with:
|
||||
|
||||
```scss
|
||||
@import 'bootstrap-custom';
|
||||
```
|
||||
|
||||
### Javascript
|
||||
|
||||
We have a helper that includes all Bootstrap javascripts. If you use Rails (or Sprockets separately),
|
||||
put this in your Javascript manifest (usually in `application.js`) to load the files in the [correct order](/vendor/assets/javascripts/bootstrap.js):
|
||||
|
||||
```js
|
||||
// Loads all Bootstrap javascripts
|
||||
//= require bootstrap
|
||||
```
|
||||
|
||||
You can also load individual modules, provided you also require any dependencies. You can check dependencies in the [Bootstrap JS documentation][jsdocs].
|
||||
|
||||
```js
|
||||
//= require bootstrap/scrollspy
|
||||
//= require bootstrap/modal
|
||||
//= require bootstrap/dropdown
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Development and Contributing
|
||||
|
@ -229,9 +257,8 @@ To convert a specific branch or version, pass the branch name or the commit hash
|
|||
The latest converter script is located [here][converter] and does the following:
|
||||
|
||||
* Converts upstream bootstrap LESS files to its matching SCSS file.
|
||||
* Copies all upstream JavaScript into `vendor/assets/javascripts/bootstrap`
|
||||
* Generates a javascript manifest at `vendor/assets/javascripts/bootstrap.js`
|
||||
* Copies all upstream font files into `vendor/assets/fonts/bootstrap`
|
||||
* Copies all upstream JavaScript into `assets/javascripts/bootstrap`, an Sprockets manifest at `assets/javascripts/bootstrap-sprockets.js`, and a concatenation at `assets/javascripts/bootstrap.js`.
|
||||
* Copies all upstream font files into `assets/fonts/bootstrap`.
|
||||
* Sets `Bootstrap::BOOTSTRAP_SHA` in [version.rb][version] to the branch sha.
|
||||
|
||||
This converter fully converts original LESS to SCSS. Conversion is automatic but requires instructions for certain transformations (see converter output).
|
||||
|
@ -262,3 +289,4 @@ Michael Hartl's [Rails Tutorial](http://railstutorial.org/), [gitlabhq](http://g
|
|||
[jsdocs]: http://getbootstrap.com/javascript/#transitions
|
||||
[sass-precision]: http://sass-lang.com/documentation/Sass/Script/Number.html#precision-class_method
|
||||
[mincer]: https://github.com/nodeca/mincer
|
||||
[autoprefixer]: https://github.com/ai/autoprefixer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue