Twbs Less Rails

Gem Version Build Status Dependency Status Code Climate Coverage Status

An opinionated gem which brings Bootstrap, Font Awesome and Respond.js assets into your Rails application.

Quick start

Add the gem to your Gemfile

gem 'twbs_less_rails'

Run the generator

$ rails g twbs_less_rails:install

Customization

Variables

Use twbs-variables.css.less to override Bootstrap defaults:

/* New variables */
@flat-ui-emerald:       #2ecc71;
@flat-ui-nephritis:     #27ae60;

@flat-ui-peter-river:   #3498db;
@flat-ui-belize-hole:   #2980b9;

/* Overrides */
@brand-primary:         @flat-ui-belize-hole;
@brand-success:         @flat-ui-nephritis;

NOTE: Remember to import twbs-variables.css.less instead of twbs/bootstrap/variables in any new LESS file.

Glyphs

Twbs Less Rails comes with Glyphicons and Fontawesome, both disabled by default. Edit your twbs.css.less to enable them.

Use Glyphicons:

@import "twbs/bootstrap/glyphicons";
//@import "fontawesome/font-awesome";

Use FontAwesome:

//@import "twbs/bootstrap/glyphicons";
@import "fontawesome/font-awesome";

Bootstrap theme

If you want to use the Bootstrap theme, uncomment //@import "twbs/bootstrap/theme" in your twbs.css.less.

Customize LESS components

If you want to exclude some LESS components, remove @import "twbs/bootstrap"; from your twbs.css.less and add the components you need, e.g.:

// Core variables and mixins
@import "twbs/bootstrap/variables";
@import "twbs/bootstrap/mixins";

// Reset
@import "twbs/bootstrap/normalize";
@import "twbs/bootstrap/print";
/* ... */

Take a look at the whole list of LESS components. Respect the order of the files and remember to edit paths.

Customize Javascript components

If you want to exclude some Javascript components, remove //= require twbs/bootstrap from twbs.js.coffee and add the components you need, e.g:

/* ... */
//= require jquery_ujs
//= require twbs/bootstrap/transition
//= require twbs/bootstrap/alert
//= require twbs/bootstrap/button
//= require turbolinks
/* ... */

Take a look at the whole list of Javascript components. Respect the order of the files and remember to edit paths.

Testing

Twbs Less Rails uses Appraisal for testing against multiple gem dependency versions.

$ appraisal install; appraisal update # Make sure your appraisals are installed and up to date
$ appraisal rake

Contributing

Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.

More over, if your pull request contains patches or features, you must include relevant unit tests.

Editor preferences are available in the editor config for easy use in common text editors. Read more and download plugins at http://editorconfig.org.

Versioning

For transparency and insight into our release cycle, and for striving to maintain backward compatibility, Twbs Less Rails will be maintained under the Semantic Versioning guidelines as much as possible. Twbs Less Rails will not follow Bootstrap's version number.

Releases will be numbered with the following format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

  • Breaking backward compatibility bumps the major (and resets the minor and patch)
  • New additions without breaking backward compatibility bumps the minor (and resets the patch)
  • Bug fixes and misc changes bumps the patch

For more information on SemVer, please visit http://semver.org/.

Authors

Geremia Taglialatela

Cesidio Di Landa

Copyright 2015 diowa under the BSD 2-Clause license.

Twitter Bootstrap is licensed under the MIT License

Font Awesome is licensed under the MIT License

Font Awesome font is licensed under the SIL Open Font License

Font Awesome pictograms are licensed under the CC BY 3.0 License

Respond.js is licensed under the MIT License