Next.js allows you to import Sass using the extensions .scss and .sass. You can use Sass at the component level through CSS modules and the extension .module.scss or .module.sass.
Creating a Custom SCSS
Let us now create a custom scss file in the styles/scss directory, and name it < ANY-NAME-OF-YOUR-CHOICE >.scss. In this file, we need to import Bootstrap’s bootstrap.scss. For the sake of simplicity, let us override the default colour system provided by Bootstrap.
The best part about the newer versions of Next is that they provide built-in support for SASS / SCSS. All we need to tell Next is where our styles are stored by setting next.config.js and adding the following code snippet:
The final step is to import our custom Bootstrap into our project. Based on where we need to use the custom styles, we can import our global.scss. In this example, let us configure it to be used by the entire project.
In pages/_app.js file, we need to add the following code: