Easiest way to change when Bootstrap navbar collapses (using bootstrap gem)

江枫思渺然 提交于 2019-12-06 11:35:07

问题


I've got a rails app using the bootstrap-sass gem. I'd like to change the width the navbar collapses from tablet (979px) to phone (769px). Overriding a media query isn't a tidy solution.

I've edited @navbarCollapseWidth in variables.less and built bootstrap, then copied the contents bootstrap-responsive.css into responsive.scss in gems...vendor/assets/stylesheets/bootstrap. Now however, I've lost the ability to update the gem without losing my changes.

What's the best method here? I'd like to make what I think is a simple change but keep my gem update-able. Perhaps using @import "bootstrap-responsive-mine"; in application.css.scss then manually updating that file when I need to?


回答1:


Did you read some info about configuration this gem?

Import "bootstrap" in your SCSS file of choice to get all of Bootstrap's styles, mixins and variables!

@import "bootstrap";

Need to configure a variable or two? Simply define the value of the variable you want to change before importing Bootstrap. Sass will respect your existing definition rather than overwriting it with the Bootstrap defaults.

$navbarCollapseWidth: 769px;
@import "bootstrap";

Or that is not what you need?



来源:https://stackoverflow.com/questions/14843416/easiest-way-to-change-when-bootstrap-navbar-collapses-using-bootstrap-gem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!