我正在尝试自定义 Bootstrap 4.我想将设置从 _variable.scss 文件复制到 _custom.scss 以覆盖.但我没有在源代码中找到 _custom.scss 文件.如何在我的项目中添加这个 _custom.scss 文件?
I was trying to customize a Bootstrap 4. I want to copy settings from _variable.scss file to _custom.scss to override. But I didn't find _custom.scss file in source code. How do I add this _custom.scss file in my project?
Bootstrap 4 大受欢迎.他们已经完全重写了它.因此,您可以非常轻松地覆盖变量.只需创建一个 _custom-variables.scss 文件并将其导入 bootstrap.scss 中的 _variables.scss 文件之前,如下所示.
Bootstrap 4 is a big hit. They have completely rewritten it. So, You can override the variables very easily. Just create a _custom-variables.scss file and import it before _variables.scss file in bootstrap.scss as shown below.
复制您要覆盖的变量,将其粘贴到 _custom-variables.scss 并根据需要更改值.同时删除 !default 属性.再次编译并完成.!default 属性与 !important 相反.它将采用先前声明的变量的值.
Copy the variable which you want to override, paste it in _custom-variables.scss and change the value as you want. Also remove the !default attribute. Compile it again and done. The !default attribute is reverse of !important. It will take the value of previously declared variable.
这篇关于如何覆盖 sass 中的引导变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!