简体   繁体   English

如何在Bootstrap 4 Rails Gem中启用Flexbox

[英]How to enable flexbox in bootstrap 4 rails gem

I started a rails project and added bootstrap gem to the Gemfile. 我启动了一个rails项目,并将bootstrap gem添加到Gemfile中。 Now I want to enable flexbox which according to the bootstrap 4 documentation is done by editing _variable.scss $enable-flex: true . 现在我想启用flexbox,根据bootstrap 4 文档,它是通过编辑_variable.scss $enable-flex: true

I added $enable-flex: true in global.scss and added this file to my application.scss . 我在global.scss添加了$enable-flex: true ,并将此文件添加到了application.scss But it's not working. 但这不起作用。

Add $enable-flex: true; 添加$enable-flex: true; in application.scss before the line with @import "bootstrap"; application.scss @import "bootstrap";之前 @import "bootstrap";

it works: 有用:

application.scss

$enable-flex: true;
// Custom bootstrap variables must be set or imported before bootstrap itself.
@import "bootstrap";

Have a look at this issue. 看看这个问题。

It mentions the fix to be a simple variable setup in the _bootstrap-flex.scss file 它在_bootstrap-flex.scss文件中提到此修补程序是一个简单的变量设置

$enable-flex: true;

@import "bootstrap";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM