2013-01-12 162 views
4

我添加到了我的新RoR應用程序 - gem twitter bootstrap。我用CSS樣式表用twitter-bootsrtap部署Rails應用程序

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

我改變了我的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 

當我部署在Heroku我的應用程序,我收到此日誌

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 

當我開始我的應用程序,我收到信息 - 「我們很抱歉,但出了點問題。」 我想,也許它在日誌

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. 

與此消息連接。如果我使用了更少的樣式表我也收到此消息

+0

只需將'gem'therubyracer''添加到您的Gemfile。 –

+0

我做到了,但沒有幫助 –

+0

當你做'heroku logs --tail'並啓動你的應用程序時,你會得到什麼錯誤? – mccannf

回答

0

只需添加這到Gemfile中

gem 'twitter-bootstrap-rails', '2.1.3' 

,然後做

bundle install 

然後推送到heroku

13

Rails使用SASS而不是LESS。您將不得不安裝less-rails寶石,以減少支持。 繼twitter-bootstrap-railsinstructions你將結束:

gem "therubyracer" 
gem "less-rails" 
gem "twitter-bootstrap-rails" 
安裝了資產組的

。這可能會解決您的問題。

+0

謝謝解決了它對我來說 – rmcsharry