Adding twitter-bootstrap-rails with an existing rails app

后端 未结 5 500
不思量自难忘°
不思量自难忘° 2021-02-08 00:11

I am trying to use twitter-bootstrap-rails with an existing rails application and getting the following error when i refreshed the page.

no such file to load -- less (

相关标签:
5条回答
  • 2021-02-08 00:50

    I got it to work by replacing the stylesheet_link_tag to bootstrap_and_overrides. However, I am using devise for authentication and twitter-bootstrap-rails, I think is messes up the devise user model because none of the logout or sign in functions work.

    0 讨论(0)
  • 2021-02-08 00:50

    I was also able to get this to work by replacing 'application' with 'bootstrap_and_overrides' in the stylesheet_link_tag tag of the layout template, per sdurg4's suggestion.

    0 讨论(0)
  • 2021-02-08 00:52

    In some case, you have not installed therubyracer.

    add

    #gem 'therubyracer' , '= 0.10.2'
    

    to your Gemfile and

    #bundle install
    

    may resolve this problem. (In my case, I could not make the rubyracer 0.11.0, so I designated 0.10.2)

    If you have not installed libv8, you have to exec

    #gem install libv8 --version=3.11.8.3
    

    or something like this before hand.

    0 讨论(0)
  • 2021-02-08 01:03

    Using rails 3.2.13:

    After I installed the 3 gems (therubyracer / less-rails / twitter-bootstrap-rails) I replaced this line *= require twitter/bootstrap with *= require bootstrap_and_overrides in application.css.

    From the github updating guide:

    This file imports Bootstrap and responsive styles for you (Responsive module is separated.) https://github.com/seyhunak/twitter-bootstrap-rails/wiki/Upgrading-Guide

    0 讨论(0)
  • 2021-02-08 01:08

    In my case, only re-starting the rails server did not do the trick. I had to do following things to fix the problem.

    1. I needed to install the missing gems first. I added following lines to my Gemfile :

      gem "therubyracer"
      gem "less-rails"
    

    Then in console I ran:

    bundle install
    

    2. Lastly, I had to re-start my rails server.

    After all these steps, twitter bootstrap started working with my rails app. Hope this helps someone who faces the same trouble that I did !

    0 讨论(0)
提交回复
热议问题