Bootstrap和Ruby on Rails的怪异问题

时间:2018-06-20 17:56:28

标签: css ruby-on-rails twitter-bootstrap

此刻我完全陷入一个非常奇怪的问题:

how the navbar component is shown

我多次尝试将引导程序添加到RoR项目中,如下所述:

这两种方法都无法真正起作用,这对我来说毫无意义,显然.css .js文件在那里,因为您可以看到应用了某些样式,但没有看到应采用的样式。 我还认为我的浏览器(chrome)搞砸了,但它与野生动物园看起来一样。 我还尝试了不同版本的滑轨,这些滑轨也无法正常工作。

真的很奇怪:选择基础而不是引导时,我也遇到类似的问题

对于能帮助我解决此问题的一切,我将表示万分感谢!

layouts / application.html.erb:

<!DOCTYPE html>
<html>
  <head>
    <title>Alphablog</title>
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>

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

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

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, 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. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery.min
//= require bootstrap.min
//= require rails-ujs
//= require activestorage
//= require turbolinks
//= require_tree .

application.scss:

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require bootstrap.min
 *= require_tree .
 *= require_self
 */

0 个答案:

没有答案