Create a structured scss file setup as shown below:
- vendors
- bootstrap
- stylesheets /*[Official Bootstrap 4 sass files]*/
- _bootstrap.scss
- scss
- themes
- _theme-1.scss
- _theme-2.scss
- _variables.scss
- styles.scss
- portal-1.scss
- portal-2.scss
_variables.scss
@import "../vendors/bootstrap/stylesheets/bootstrap/variables";
@import "../vendors/bootstrap/stylesheets/bootstrap/mixins";
/* override default bootstrap variables */
/* define custom variables with !default */
styles.scss
@import "variables";
@import "../vendors/bootstrap/stylesheets/bootstrap";
/* add custom styles */
themes/_theme-1.scss
@import "../variables";
/* modify bootstrap and custom variables */
$brand-primary: #428bca
$brand-success: #5cb85c;
$brand-info: #5bc0de;
$brand-warning: #f0ad4e;
$brand-danger: #d9534f;
$body-bg: #eff;
themes/_theme-2.scss
@import "../variables";
/* adjust bootstrap and custom variables */
$brand-primary: #C04848;
portal-1.scss
@import "themes/_theme-1";
/* apply style changes using new bootstrap variables */
.portal-1 {
@import "../vendors/bootstrap/stylesheets/bootstrap/buttons";
@import "../vendors/bootstrap/stylesheets/bootstrap/alerts";
/* customize styles here */
}
portal-2.scss
@import "themes/_theme-2";
/* apply style changes using new bootstrap variables */
.portal-2 {
@import "../vendors/bootstrap/stylesheets/bootstrap/buttons";
@import "../vendors/bootstrap/stylesheets/bootstrap/alerts";
/* include custom styles from style.scss overrides */
}
Upon compilation, you will have styles.css, portal-1.css, and portal-2.css files.
Include styles.css by default and the others in the head tag for theming.
<html>
<head>
<link href="styles.css" rel="stylesheet" />
<link href="portal-1.css" rel="stylesheet" />
</head>
<body>
<button class="btn btn-primary">BUTTON</button>
<div class="portal-1">
<button class="btn btn-primary">BUTTON</button>
</div>
</body>
</html>