0
votes

I would like to use Twitter Bootstrap with a current Ruby on Rails version. I tried to use "less-rails-bootstrap". I followed: http://rubysource.com/twitter-bootstrap-less-and-sass-understanding-your-options-for-rails-3-1/

I created a new rails project. Then I added "gem 'less-rails-bootstrap'" to the Gemfile, installed it and after that I added " *= require twitter/bootstrap" to application.css

I got this error:

Showing /var/www/lrb/app/views/layouts/application.html.erb where line #5 raised:

V8::Error
(in /usr/lib/ruby/gems/1.8/gems/less-rails-bootstrap-2.3.0/vendor/assets/stylesheets/twitter/bootstrap.css.less)

I could not find how I can fix the V8::Error. Line 5 in application.html.erb: <%= stylesheet_link_tag "application", :media => "all" %>

My installed Gem's:

Using rake (10.0.3) 
Using i18n (0.6.4) 
Using multi_json (1.6.1) 
Using activesupport (3.2.12) 
Using builder (3.0.4) 
Using activemodel (3.2.12) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.5) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.1) 
Using tilt (1.3.4) 
Using sprockets (2.2.2) 
Using actionpack (3.2.12) 
Using mime-types (1.21) 
Using polyglot (0.3.3) 
Using treetop (1.4.12) 
Using mail (2.4.4) 
Using actionmailer (3.2.12) 
Using arel (3.0.2) 
Using tzinfo (0.3.36) 
Using activerecord (3.2.12) 
Using activeresource (3.2.12) 
Using coffee-script-source (1.6.1) 
Using execjs (1.4.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.3) 
Using json (1.7.7) 
Using rdoc (3.12.2) 
Using thor (0.17.0) 
Using railties (3.2.12) 
Using coffee-rails (3.2.2) 
Using commonjs (0.2.6) 
Using jquery-rails (2.2.1) 
Using less (2.2.2) 
Using less-rails (2.2.6) 
Using less-rails-bootstrap (2.3.0) 
Using libv8 (3.11.8.13) 
Using bundler (1.3.0) 
Using rails (3.2.12) 
Using ref (1.0.2) 
Using sass (3.2.6) 
Using sass-rails (3.2.6) 
Using sqlite3 (1.3.7) 
Using therubyracer (0.11.4) 
Using uglifier (1.3.0)

How can I use Bootstrap with Rails 3.2.12? Thank you very much for your help!

3

3 Answers

1
votes

I use 'bootstrap-sass' gem but I suppose it follows the same convention.

After I bundled the gem, I do not add anything in the application.css; according with the documentation of the gem:

We recommend against using //= require directives, since none of your other stylesheets will be able to use the awesome mixins that Bootstrap has defined

Instead you can create a new css.scss file and at the top @import 'bootstrap';

Job done!

0
votes

I faced same issue sometime back and i switched to anjlab bootsrap rails which gives Twitter Bootstrap CSS (with Sass flavour)

gem 'anjlab-bootstrap-rails', '>= 2.3', :require => 'bootstrap-rails'

0
votes