

Here, we are going to use the npm package: sass.Īfter downloading Bootstrap, and the Sass compiler, in the node-modules directory, there is a folder named bootstrap. Feel free to use whatever Sass compiler you're comfortable with. Also, there is a Live Sass Compiler VS Code extension with over 2 million installs. Whether you're on Windows, Mac, or Linux you just need to download the dart-sass package, unzip it, and add it to the path (environment variables). We can get the official dart-sass version from their website. We also need to install the Sass compiler. Since we have Node.js installed, I'm going to use the npm version. The Prerequisitesĭownload Bootstrap from the official website: Once we can do these, it will become easy to do other customizations. We will also change the default media breakpoints Bootstrap uses.We will change the primary and secondary theme colors Bootstrap ships with.Whatever the style is, indented Sass or CSS-like SCSS, the Sass compiler will transpile it to vanilla CSS to be used on the browser. In this tutorial, we are going to use the SCSS version. scss extension (or SCSS interspersed with CSS) is also valid Sass code.

The older one uses indentation and the newer SCSS syntax (SCSS for Sassy CSS) uses CSS-like curly braces. You can also refer to other tutorials on freeCodeCamp, like this one on how to use Sass with CSS, or this video course on how to use Sass with Bootstrap 5. If you want to learn Sass, the official website is an excellent resource. You may have heard the tagline, "Sass is CSS with superpowers". The source code for the Bootstrap 4 and 5 frameworks is written entirely in Sass, which is a testimony to how mature Sass has become. But since version 4, Bootstrap uses only Sass. Until Bootstrap version 3.x, you had a choice between CSS preprocessors: Less or Sass. Sass is compiled down to CSS before it's used on web pages.

The solution is to use Sass – a CSS preprocessor. So there has to be another, cleaner, way. But for larger projects, this can be time-consuming and there may be a lot of redundant style declarations. You write custom CSS, with the same or higher specificity, and link to it in the head section of your index.html after the line which links to the original Bootstrap CSS. If you're a beginner, you can customize Bootstrap with a custom CSS stylesheet. Fortunately, Bootstrap is also highly customizable. Some developers and teams find that code written in Bootstrap is easier to maintain than regular CSS, so they prefer Bootstrap to vanilla CSS.īut if everyone used Bootstrap with its default styles, then every site would look the same – and quickly, the internet would become pretty bland. Bootstrap is an awesome CSS framework that can help you create stylish and sleek websites.
