我有我添加了自舉寶石Ruby on Rails的引導CSS JS工作,但沒有找到
首先我將此兩種寶石
gem 'bootstrap'
gem 'sprockets-rails', :require => 'sprockets/railtie'
裏面裝了這個包
Using bootstrap 4.0.0.alpha3
Using sprockets 3.6.0
Rails應用程序
我修改後application.scss
至
// Custom bootstrap variables must be set or import before bootstrap itself.
@import "bootstrap";
後來我就離開application.js
這樣
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require tether
//= require bootstrap-sprockets
//= require_tree .
//= require_self
最後我application.html.erb
是這個
<!DOCTYPE html>
<html>
<head>
<title>Squirm</title>
<%= stylesheet_link_tag "bootstrap" %>
<%= javascript_include_tag "bootstrap" %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>
<%= render 'partials/navbar' %>
<div class="container">
<%= yield %>
</div>
</body>
</html>
引導似乎我們的工作,但在谷歌瀏覽器控制檯似乎並沒有被發現
謝謝@AnthonyE我有兩個錯誤,首先是導入順序,其次是我爲項目添加了兩次bootstrap。 – agusgambina