In the previous recipe, we built our own copy of Bootstrap 4 docs, running on Jekyll. In this recipe, we will see how to change the styling of our Bootstrap 4 docs by making simple changes to Sass variables.
Customizing the styles of Bootstrap 4 docs
Getting ready
For this recipe to work, you need to complete the previous two recipes, Installing Bootstrap 4 to c9 IDE using npm and Installing Bootstrap 4 to c9 IDE via git. The following steps will show you how to tweak the look of the docs by changing some of the Sass variables in the scss folder.
How to do it...
- Stop the running Jekyll server by clicking inside the Bash console tab and using Ctrl + C.
- Navigate to the scss folder and open the _variables.scss file:
cd && cd workspace/scss && c9 _variables.scss
- Find the Sass variable $enable-rounded, and uncomment the line it is on, so that it looks like this:
// $enable-rounded: true !default;
- On the very next line, paste in the following code:
$enable-rounded: false !default;
- Still in console, change directory into the scss folder by running cd scss command. Then, run the following command:
sass bootstrap.scss ../dist/css/bootstrap.css
This command will recompile SCSS into CSS for Bootstrap docs.
- Go back out from the scss folder, by running cd ... Back in the console tab, run the following command:
bundle exec jekyll serve --watch --host $IP --port $PORT --
baseurl ''
When you refresh the webpage, it will now show the homepage with the Download Bootstrap button with sharp edges, instead of rounded ones, as seen in the following screenshot:
- Back in the _variables.scss file, override the default values by adding more changes:
$white: #ddd;
$enable-rounded: false;
$spacer: 8rem;
$font-size-base: 2rem;
You should probably make use of your code editor's search and replace function to complete this step. Once you have completed the step, make sure that you save the file.
- Recompile SCSS again by pointing your console to the scss folder with cd scss, then running the command from step 6 once again:
sass bootstrap.scss ../dist/css/bootstrap.css
- Rebuild Jekyll by running:
bundle exec jekyll build;
- Go into _gh_pages and run Jekyll server:
jekyll serve --watch --host $IP --port $PORT --baseurl ''
This should result in the following changes on the docs website: