Chapter 12: Optimizing Bootstrap 5 CSS and JavaScript Code
In this chapter, we’re not going to use Bootstrap 5 to create any new user interfaces or customize any existing ones. We won’t even look at any of the source code contained in the Bootstrap 5 files. Instead, we will see how we can optimize our compiled Bootstrap 5 CSS and JavaScript code after we have finished creating our website.
We will first concentrate on optimizing our stylesheet by only including the Bootstrap 5 Sass partials we actually use and removing all the helpers and utilities that we don’t use. Then we will use Node.js, NPM, and Laravel Mix to set up a build process to automate some tasks that will help us bundle only the JavaScript that our components actually use and minify both our compiled CSS and bundled JavaScript.
In this chapter, we’re going to cover the following main topics:
- Including the Sass partials for the used components only
- Removing unused helpers...