Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy Rails application with twitter-bootstrap

I added to my new RoR application - gem twitter bootstrap. I used CSS stylesheets

gem "twitter-bootstrap-rails"
rails generate bootstrap:install static

I changed my GEMFILE

group :assets do
          gem 'sass-rails',   '~> 3.2.3'
          gem 'coffee-rails', '~> 3.2.1'
          gem 'uglifier', '>= 1.0.3'

          gem "twitter-bootstrap-rails"
end

And when I deployed my app on Heroku, I received this log

 Delta compression using up to 4 threads.
Compressing objects: 100% (59/59), done.
Writing objects: 100% (70/70), 26.75 KiB, done.
Total 70 (delta 4), reused 0 (delta 0)
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.3.0.pre.5
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       Fetching gem metadata from https://rubygems.org/.........
       Fetching gem metadata from https://rubygems.org/..
       Installing rake (10.0.3)
       Installing i18n (0.6.1)
       Installing multi_json (1.5.0)
       Installing activesupport (3.2.9.rc2)
       Installing builder (3.0.4)
       Installing activemodel (3.2.9.rc2)
       Installing erubis (2.7.0)
       Installing journey (1.0.4)
       Installing rack (1.4.3)
       Installing rack-cache (1.2)
       Installing rack-test (0.6.2)
       Installing hike (1.2.1)
       Installing tilt (1.3.3)
       Installing sprockets (2.8.2)
       Installing actionpack (3.2.9.rc2)
       Installing mime-types (1.19)
       Installing polyglot (0.3.3)
       Installing treetop (1.4.12)
       Installing mail (2.4.4)
       Installing actionmailer (3.2.9.rc2)
       Installing arel (3.0.2)
       Installing tzinfo (0.3.35)
       Installing activerecord (3.2.9.rc2)
       Installing activeresource (3.2.9.rc2)
       Installing coffee-script-source (1.4.0)
       Installing execjs (1.4.0)
       Installing coffee-script (2.2.0)
       Installing rack-ssl (1.3.2)
       Installing json (1.7.6)
       Installing rdoc (3.12)
       Installing thor (0.16.0)
       Installing railties (3.2.9.rc2)
       Installing coffee-rails (3.2.2)
       Installing commonjs (0.2.6)
       Installing jquery-rails (2.1.4)
       Installing less (2.2.2)
       Installing less-rails (2.2.6)
       Installing libv8 (3.11.8.13)
       Using bundler (1.3.0.pre.5)
       Installing rails (3.2.9.rc2)
       Installing ref (1.0.2)
       Installing sass (3.2.5)
       Installing sass-rails (3.2.5)
       Installing therubyracer (0.11.2)
       Installing twitter-bootstrap-rails (2.2.0)
       Installing uglifier (1.3.0)
       Your bundle is complete! It was installed into ./vendor/bundle
       Post-install message from rdoc:
       Depending on your version of ruby, you may need to install ruby rdoc/ri data:
       <= 1.8.6 : unsupported
       = 1.8.7 : gem install rdoc-data; rdoc-data --install
       = 1.9.1 : gem install rdoc-data; rdoc-data --install
       >= 1.9.2 : nothing to do! Yay!
       Post-install message from twitter-bootstrap-rails:
       Important: You may need to add a javascript runtime to your Gemfile in order for bootstrap's LESS files to compile to CSS.
       **********************************************
       ExecJS supports these runtimes:
       therubyracer - Google V8 embedded within Ruby
       therubyrhino - Mozilla Rhino embedded within JRuby
       Node.js
       Apple JavaScriptCore - Included with Mac OS X
       Microsoft Windows Script Host (JScript)
       **********************************************
       Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       Asset precompilation completed (25.98s)
-----> Rails plugin injection
       Injecting rails_log_stdout
       Injecting rails3_serve_static_assets
-----> Discovering process types
       Procfile declares types      -> (none)
       Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size: 15.9MB
-----> Launching... done, v6
       http://rocky-badlands-2634.herokuapp.com deployed to Heroku

When I start my app, I receive message - "We're sorry, but something went wrong." I think maybe it's connected with this message in log

Post-install message from twitter-bootstrap-rails:
Important: You may need to add a javascript runtime to your Gemfile in order for bootstrap's LESS files to compile to CSS.

If I use the Less stylesheets I also receive this message

like image 211
Gavrilov Pavel Avatar asked Jan 12 '13 23:01

Gavrilov Pavel


1 Answers

Rails uses SASS instead of LESS. You will have to install the less-rails gem to have LESS support. Following the twitter-bootstrap-rails instructions you will end up with:

gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"

installed out of the assets group. This might solve your problem.

like image 72
Helio Santos Avatar answered Sep 28 '22 08:09

Helio Santos