简体   繁体   English

使用Bootstrap 4和Sass(和Bower)?

[英]Working with Bootstrap 4 and Sass (and Bower)?

I'm learning to use Sass (never used a CSS pre-processor before), and I'm wondering how to use it with Bootstrap 4 properly. 我正在学习使用Sass(以前从未使用过CSS预处理器),并且想知道如何在Bootstrap 4中正确使用它。

Should I include in my header.php files the bootstrap.min.css? 我应该在header.php文件中包含bootstrap.min.css吗? Then when I need to use a Sass mixin or some variable, do I include it in my .scss file? 然后,当我需要使用Sass mixin或某些变量时,是否将其包括在我的.scss文件中?

OR 要么

Should I include all of bootstrap.scss in my styles.scss, then compile it to one style.css and only include that? 我是否应该将所有bootstrap.scss包含在我的styles.scss中,然后将其编译为一个style.css并仅包含它?

Thanks for your guys' help. 谢谢你们的帮助。

You should have a main file (a Sass manifest) where you import your Sass variables, mixins and partials as well as the Bootstrap library. 您应该有一个主文件(一个Sass清单),在其中导入Sass变量,mixins,partials以及Bootstrap库。 After that's in place Sass will automatically output a CSS file you can include on your header.php file. 到位后,Sass将自动输出一个CSS文件,您可以将其包含在header.php文件中。

Gotchas 陷阱

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

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