Это продолжение rails, bootstrap, media-breakpoint-only , но я не думаю, что нужно возвращаться к этому.
У меня есть проект Rails, в котором я пытаюсь использовать функцию Bootstrap только для media-breakpoint.
Поиск на моем компьютере показывает, что только точка прерывания носителя определяется в ~ / .rbenv / version / 2.5.1 / lib / ruby / gems / 2.5.0 / gems / bootstrap-4.1.3 / assets / stylesheets /bootstrap/mixins/_breakpoints.scss
Мои ~ / app / assets / stylesheets / application.scss is
/*
* 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_tree .
* require_self
*/
// See
// https://www.youtube.com/watch?v=vcBXXOdPfgE&index=8&list=PLYM1n9xxMy4ClO2GjX73U3BLsXx9Z7wh5
$navbar-default-bg: red;
// Shnelvar
// See https://github.com/twbs/bootstrap-sass
@import "bootstrap-sprockets";
// Custom bootstrap variables must be set or imported *before* bootstrap.
@import "bootstrap";
// Shnelvar
// For ralph-shiny-button etc.
@import "ralph";
// Shnelvar
// See https://stackoverflow.com/questions/33404154/bootstrap-change-the-navbar-font-size
// See https://teamtreehouse.com/community/how-do-you-change-the-bootstrap-font-style
.nav a{
color: white !important;
// font-size: 3.8em !important;
font-size: 2.8em;
}
@import "bootstrap/breakpoints";
// See https://getbootstrap.com/docs/4.0/layout/overview/
h1 {
@include media-breakpoint-only(xs) {
color: red;
}
@include media-breakpoint-only(sm) {
color: green;
}
@include media-breakpoint-only(md) {
color: blue;
}
@include media-breakpoint-only(lg) {
color: yellow;
}
@include media-breakpoint-only(xl) {
color: orange;
}
}
Обратите внимание, что у меня есть
* require_tree .
* require_self
а не
*= require_tree .
*= require_self
так что, я считаю, «требуется» закомментировано.
Когда я пытаюсь загрузить свою веб-страницу, я получаю следующую ошибку:
Sass::SyntaxError in StaticPages#root
Showing ~/app/views/layouts/application.html.erb where line #15 raised:
File to import not found or unreadable: bootstrap/breakpoints.
Load paths:
~/app/assets/config
~/app/assets/images
~/app/assets/javascripts
~/app/assets/stylesheets
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/coffee-rails-4.2.2/lib/assets/javascripts
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jquery-rails-4.3.3/vendor/assets/javascripts
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/actioncable-5.2.0/lib/assets/compiled
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activestorage-5.2.0/app/assets/javascripts
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/actionview-5.2.0/lib/assets/compiled
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/turbolinks-source-5.1.0/lib/assets/javascripts
~/node_modules
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootstrap-sass-3.3.7/assets/stylesheets
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootstrap-sass-3.3.7/assets/javascripts
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootstrap-sass-3.3.7/assets/fonts
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootstrap-sass-3.3.7/assets/images
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootstrap-sass-3.3.7/assets/stylesheets
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootstrap-sass-3.3.7/assets/javascripts
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/popper_js-1.14.3/assets/javascripts
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootstrap-sass-3.3.7/assets/stylesheets
~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootstrap-sass-3.3.7/assets/stylesheets
Очевидно, ~ / .rbenv / versions / 2.5.1 / lib / ruby / gems / 2.5.0 / gems / bootstrap-4.1.3 / assets / stylesheets / bootstrap / mixins / не загружен пути.
Я думаю, у меня может быть ошибка rbenv, но я не уверен.
Моя среда
Рельсы 5.2.0
ruby 2.5.1p57 (версия 20130-03-29 63029) [x86_64-linux]
Пожалуйста, обратите внимание, что если я избавлюсь от @import "bootstrap / breakpoints"; и h1 css, что я могу успешно использовать навигационную панель Bootstrap. Таким образом, я полагаю, я успешно установил загрузчик.
Помощь !!!