3

나는 official guidethis post을 따랐지만 아무에게도이를 알려 줄 수 있습니까? (source on github)레일즈가있는 부트 스트랩 4

내 보석 파일 :

... 
#bootstrap 
gem 'bootstrap', '~> 4.0.0.alpha3.1' 
gem 'sprockets-rails', :require => 'sprockets/railtie' 

source 'https://rails-assets.org' do 
    gem 'rails-assets-tether', '>= 1.1.0' 
end 
... 

내 application.scss :

@import 'bootstrap-sprockets'; 
@import 'bootstrap'; 

내 application.js :

//= require jquery 
//= require tether 
//= require bootstrap-sprockets 
//= require jquery_ujs 
//= require turbolinks 
//= require_tree . 

내 application.html.erb :

<!DOCTYPE html> 
<html> 
    <head> 
    <title>DankDist</title> 
    <%= csrf_meta_tags %> 

    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 
    </head> 

    <body> 
    <%= yield %> 
    </body> 
</html> 

그리고 마지막으로, 내 index.html.erb은 :

<h1>Scale#index</h1> 
<div class="alert alert-success" role="alert"> 
    <strong>Well done!</strong> You successfully read this important alert message. 
</div> 
<p>Hello Worldzz</p> 
<p>Find me in app/views/scale/index.html.erb</p> 
<%= params[:id] %> <br/> 
<%= @id %> 

Next Page <%= @page +1 %> 

<hr/> 
<%= params.inspect %> 

나는 번들을 실행하고, 변경없이 rails s를 재 - 시도, 헤더는 어떤 스타일을 포함하지 않습니다. 따라서 귀하의 application.html.erb에서 스타일 시트 가져 오기
  • @import '부트 스트랩-톱니를'작동하지 않습니다 -

  • +0

    당신은 아직도 당신의 require_tree이 필요합니다. 귀하의 application.css.scss. scss의 이름을 css.scss로 변경 한 다음/* = require ....를 추가하십시오. */안에 문자열을 잊어 버렸습니다. http://stackoverflow.com/a/21643987/3338439 – Mingsheng

    +0

    게시물을 참조한 후에도 여전히 작동하지 않습니다 –

    +0

    부트 스트랩을 사용해서는 안됩니까? – Mingsheng

    답변

    2

    1. ScaleController 레이아웃 거짓이 포함 된 몇 가지 실수 있습니다 application.js에서 부트 스트랩 4 보석
    -2

    필요하지 않습니다, 나는 그것이 나를 위해 일한 발견, 다음과 같이이 두 줄을 줄하려고 :

    //= require jquery 
    //= require bootstrap-sprockets