gpt4 book ai didi

ruby-on-rails - 使用 Rails 5 的 Bootstrap4

转载 作者:数据小太阳 更新时间:2023-10-29 08:11:21 24 4
gpt4 key购买 nike

我关注了 official guidethis post没有帮助,有人可以对此有所了解吗? ( source on github )

我的 Gem 文件:

...
#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
...

我的应用程序.scss:

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

我的应用程序.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 %>

我运行了 Bundle,并重新尝试了 rails s,没有任何变化,header 不包含任何样式。

最佳答案

有几个错误

  1. ScaleController 包含布局 false - 因此您在 application.html.erb 中导入的样式表不起作用
  2. @import 'bootstrap-sprockets';对于 Bootstrap 4 gem 不是必需的

关于ruby-on-rails - 使用 Rails 5 的 Bootstrap4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39344995/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com