StartBootstrap / startbootstrap-sb-admin-2

A free, open source, Bootstrap admin theme created by Start Bootstrap
https://startbootstrap.com/themes/sb-admin-2/
MIT License
9.76k stars 5.72k forks source link

[Not a bug] - Why bs and sb-admin-2 css in single file? #315

Closed iyilm4z closed 4 years ago

iyilm4z commented 4 years ago

I'm used to see bs and admin css files separated. That's why we import these css files separately or we could be using cdn. As you can see sb-admin-2.css contains also bs css. Nowadays i see bs with custom styles in a single merged file. AdminLTE also does the same. Why?

tiesont commented 4 years ago

Most likely? That CSS file is built from this template's Sass file, here: https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/master/scss/sb-admin-2.scss

If you inspect that file, at line 2 you'll see this:

@import "variables.scss";

followed by this at line 5:

@import "../vendor/bootstrap/scss/bootstrap.scss";

Line 5 pulls in Bootstrap's Sass file, so the generated CSS file is also going to include Bootstrap. The variables.scss file contains overrides for some of Bootstrap's variables, which is easier than trying to add overriding rules in a normal CSS file (and is actually the method recommended by the Bootstrap team).

iyilm4z commented 4 years ago

@tiesont thanks! i got it now. It's related to how b4's recommended way of theming.