Bootstrap partial Sass

Bootstrap is a component-based library for developing web UI. Not all components are used when developing frontend with Bootstrap. In order to minimize the number of unused styles in a project, create a single sass file with custom imports of bootstrap components. Start with adding bootstrap as npm/yarn dependency, copy contents of a bootstrap.scss (defined in bootstrap/sass directory of node_modules) to a new file and change the imports path accordingly. The following is an example of the sass file that imports some bootstrap components:

// styles/bootstrap/_bootstrap.scss 
// Import constants overrides 
@import './constants;

// Import bootstrap components 
@import '~bootstrap/scss/functions'; 
@import '~bootstrap/scss/variables'; 
@import '~bootstrap/scss/mixins'; 
@import '~bootstrap/scss/root';

// styles/bootstrap/_constants.scss 
$body-bg: red;

The ~ (tilde) is used for resolving from node_modules and is supported by sass-loader (webpack). For ember.js use ember-cli-bootstrap-sassy dependency, but without the tilde prefix.


ESLint is code linting utility for JavaScript. Code linting is a static code analysis that is used to find potential problems and can enforce code style guides. To use ESLint, start by installing it with npm install -g eslint and creating an .eslintrc file for configuration. Run a check against a file with eslint src/some-file.js. ESLint can be integrated with various editors like Sublime Text, Atom and VSCode via plugins where one can get instant feedback on the code and make necessary changes.

Whenever you start a new project, start by using ESLint and adhere to its rules.

“Bootstrap partial Sass & ESLint” Tech Bite was brought to you by Kenan Klisura, Lead Software Engineer at Atlantbh. 

Tech Bites are tips, tricks, snippets or explanations about various programming technologies and paradigms, which can help engineers with their everyday job.

Decorator pattern
Software DevelopmentTech Bites
January 23, 2023

Decorator pattern

Design patterns are typical solutions to common problems in software design. Each pattern is like a blueprint that you can customize to solve a particular design problem in your code. A decorator pattern allows users to add new functionality to an existing object without altering its structure. This design pattern comes under…

Leave a Reply