Papouche Guinslyzinho
Papouche Guinslyzinho

Reputation: 5458

looking for twitter-bootstrap source files in rails

I have the gem "twitter-bootstrap-rails". And I want to modify some sources files (js && less). Less is importing some files but I don't see where it takes the @import "fontawesome/font-awesome"; from? I don't see them in my app/assets... || vendor/assets...

Upvotes: 0

Views: 49

Answers (2)

Малъ Скрылевъ
Малъ Скрылевъ

Reputation: 16507

Edit the , adding to it the link to local resided .

:

 gem 'twitter-bootstrap-rails', :path => '/home/user/git/twitter-bootstrap-rails'

Clone the twitter-bootstrap-rails , and issue installation of gems for your project:

$ cd /home/user/git
$ git clone https://github.com/seyhunak/twitter-bootstrap-rails.git
$ cd /your/project/path
$ bundle install

So you can edit then the bootstrap's files.

Run you app with bundler:

$ bundle exec rails s

Upvotes: 1

QMFNP
QMFNP

Reputation: 997

If you want to use different versions of the javascript files than the ones that come bundled with the gem, the first step is to make sure the following isn't in your application.js:

//= require twitter/bootstrap

When you require 'twitter/bootstrap', it loads all of the individual javascript files for you. Instead, you can specify which ones you want the gem to load for you, and then you can manually require the ones that you have modified.

For example, if your modified source files were in app/assets/javascripts/bootstrap_overrides/, you would do:

//= require twitter/bootstrap/bootstrap-transition
//= require twitter/bootstrap/bootstrap-alert
//= require twitter/bootstrap/bootstrap-modal
//= require twitter/bootstrap/bootstrap-button
//= require twitter/bootstrap/bootstrap-collapse
//  ... do this for the remainder of the components you wish to import from the gem
//= require bootstrap_overrides/dropdown.js
//= require bootstrap_overrides/tooltip.js

This will let you use your own modified js instead of what's supplied with the gem. The source for the versions of tooltip.js and dropdown.js included in the gem are available at the gem's github repo: https://github.com/seyhunak/twitter-bootstrap-rails

Also, since these components require jQuery to work, be sure to include them after jQuery in your application.js

Hope this helps!

Upvotes: 0

Related Questions