問題描述
我正在嘗試自定義 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模板網!