2014-03-29 62 views
0

我正在關注this教程,並且從現在開始,它告訴我要集成bootstrap,我已經丟失了。我對bootstrap一無所知,所以我無法真正排除故障。沒有任何反應,格式繼續看起來像沒有任何CSS樣式的標準HTML。Ruby on Rails 4中的Bootstrap-sass不會執行任何操作

這是我application.css.scss文件:

/* 
*= require_self 
*= require_tree . 
*/ 
@import 'bootstrap'; 

這是我的application.js文件:

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

這是我的觀點文件(home.html.haml):

.container 
    - if @tasks.empty? 
    %span.text-warning There are no tasks! 
    - else 
    %table.table.table-hover.table-bordered 
     %thead 
     %tr 
      %th Title 
      %th Created at 
      %th Completed 
     %tbody 
     - @tasks.each do |task| 
      %tr 
      %td 
       %strong= task.title 
      %td.text-info= task.created_at 
      %td.text-success= task.completed 

我知道這是非常具體的,但因爲我不知道bootstrap的任何內容,所以我不知道該怎麼關注這個問題。我跑的Rails 4.0.4,和自舉 - 薩斯的Gemfile是2.3.2.0

+0

它的工作原理是因爲我忽略了一個無關代碼中的錯誤。我的錯誤。道歉。 –

回答

1

我剛剛創建了一個測試的Rails 4.0.4應用程序,更名爲application.css文件application.css.scss並添加您的

@import 'bootstrap'; 

線。順便說一下,我切換到最新的寶石版本:

gem 'bootstrap-sass', '~> 3.1.1.0' 

一切工作正常。 更新您的Gemfile,運行bundle update,重啓服務器並重試。它應該工作正常。