2016-08-24 41 views
0

我下面截屏約twitter bootstrap basics試圖瞭解更多的引導,但由於某些原因,當我去到localhost,我的應用程序沒有任何造型。Twitter的引導不工作在軌道上

我已經試過的步驟從GitHub回購https://github.com/seyhunak/twitter-bootstrap-rails爲好。

我也遵循this SO post的說明,但是當我添加行*= require bootstrap_and_overrides時,它顯示FileNotFound錯誤。

這裏是我做的,Rails的後新的應用bootstrap_practice

rails g scaffold Product name price:decimal --skip-stylesheets 
rake db:migrate 
# added gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git' on gemfile (I have also tried just gem 'twitter-bootstrap-rails' 
bundle install 
rails g bootstrap:install 

我清產覈資,並有必要的財產。

樣式表(application.css)

* 
*= require_tree . 
*= require_self 
*/ 

JS:

//= require jquery 
//= require jquery_ujs 
//= require twitter/bootstrap 
//= require turbolinks 
//= require_tree . 

最後,我application.html.erb有

<%= csrf_meta_tags %> 
<%= stylesheet_link_tag "application", :media => "all" %> 
<%= javascript_include_tag "application" %> 

我敢肯定,就是一切需要。爲什麼我的應用程序在本地主機上沒有樣式?

+0

我喜歡用原來的寶石創作者:'的https:// github.com /拼焊板/引導-sass'對我來說真是棒極了.. – liborza

+0

超級基本問題,但就是'Twitter的引導護欄之間的區別'寶石與'bootstrap-sass'寶石?他們是否基本上做同樣的事情(造型),但是前一顆寶石是「非官方」寶石? – Iggy

+1

區別在於使用SASS的官方寶石,但使用LESS的是你的。 [SASS VS更少](http://www.zingdesign.com/less-vs-sass-its-time-to-switch-to-sass/) – liborza

回答

0

一位官員SASS回購發行以來,railscasts被釋放。 (Rails有SASS開箱。)

https://github.com/twbs/bootstrap-sass

通過seyhunak回購被保持在更小,這需要therubyracer太。

+0

我只注意到一個已經越來越另一SASS,有什麼區別? – Iggy

+0

它們都是CSS預處理器。他們爲CSS添加了很多功能,如變量和mixin。使用SASS寶石將讓你自定義的引導通過覆蓋在SASS的樣式,而欠寶石會做同樣的LESS。您可以訪問所有定義的引導程序變量以進行定製。就我個人而言,我是SASS的粉絲。 – codyeatworld

1

所以,我使用Twitter的自舉了很多在Rails的方式,我最喜歡的是與bh寶石。在github上的Bootstrap Helpers

# Gemfile 
gem 'bh' 

# application.html.erb 
<%= stylesheet_link_tag bootstrap_css %> 
<%= stylesheet_link_tag font_awesome_css %> 
<%= javascript_include_tag bootstrap_js %> 

所有資產都通過CDN交付。

+0

感謝您的輸入!我會查出bh-gem! – Iggy