Currently, we are developing an MVP using vue.js and have chosen to incorporate bootstrap for consistent styling of the elements on our single-page app.
As we begin to implement the skin/theme into our application, we have encountered an issue with unnecessary css being rendered on the page. Although we have successfully overridden these styles with higher specificity css selectors, we aim to optimize the code output by removing any unused "base" bootstrap css.
The Question:
How can we configure our environment to eliminate redundant css code from the bootstrap sass files?
Additional Details:
- Bootstrap loads its own
_buttons.scss
file upon initialization. - We have added our custom "theme"
_buttons.scss
file after the bootstrap file, ensuring our styles take precedence. - We compile the sass code using node-sass compiler.
- The resulting css includes both the original bootstrap styles as well as our themed styles for buttons.
In the screenshot provided, you can see that our button style is properly applied, but the default bootstrap style remains present in the output.
Our goal is to only display OUR STYLES in the browser.
Update:
The user interface we are creating includes classes directly from bootstrap along with our custom application-specific classes.
At times, it is necessary to override the default bootstrap styles using our custom styles, including colors and other css attributes defined in _variables.scss
.
However, we are encountering duplicated css in the browser; displaying both our custom styles and the default bootstrap styles which are not required due to lower specificity.
We are looking for a solution to prevent compiling unnecessary sass code while also refraining from modifying the bootstrap code within ./node_modules/
.