"roboto",
"RTLCSS",
"ruleset",
+ "sassrc",
"screenreaders",
"scrollbars",
"scrollspy",
Utilize our source Sass files to take advantage of variables, maps, mixins, and more.
+{{< callout warning >}}
+Sass deprecation warnings are shown when compiling source Sass files with the latest versions of Dart Sass. This does not prevent compilation or usage of Bootstrap. We're [working on a long-term fix]({{< param repo >}}/issues/40962), but in the meantime these deprecation notices can be ignored.
+{{< /callout >}}
## File structure
Whenever possible, avoid modifying Bootstrap's core files. For Sass, that means creating your own stylesheet that imports Bootstrap so you can modify and extend it. Assuming you're using a package manager like npm, you'll have a file structure that looks like this:
*You can also import our stylesheets individually if you want. [Read our Sass import docs]({{< docsref "/customize/sass#importing" >}}) for details.*
+ **Optional:** You may see Sass deprecation warnings with the latest versions of Dart Sass. These can silenced by adding the following configuration in a `.sassrc.js` file in the root folder with the following:
+
+ ```js
+ module.exports = {
+ silenceDeprecations: ['import', 'mixed-decls', 'color-functions', 'global-builtin']
+ }
+ ```
+
2. **Import Bootstrap's JS.** Add the following to `src/js/main.js` to import all of Bootstrap's JS. Popper will be imported automatically through Bootstrap.
<!-- eslint-skip -->
},
server: {
port: 8080
- }
+ },
+ // Optional: Silence Sass deprecation warnings. See note below.
+ css: {
+ preprocessorOptions: {
+ scss: {
+ silenceDeprecations: [
+ 'import',
+ 'mixed-decls',
+ 'color-functions',
+ 'global-builtin',
+ ],
+ },
+ },
+ },
}
```
+ **Note:** Sass deprecation warnings are shown when compiling source Sass files with the latest versions of Dart Sass. This does not prevent compilation or usage of Bootstrap. We're [working on a long-term fix]({{< param repo >}}/issues/40962), but in the meantime these deprecation notices can be ignored.
+
2. **Next we fill in `src/index.html`.** This is the HTML page Vite will load in the browser to utilize the bundled CSS and JS we'll add to it in later steps.
```html
},
{
// Loads a SASS/SCSS file and compiles it to CSS
- loader: 'sass-loader'
+ loader: 'sass-loader',
+ options: {
+ sassOptions: {
+ // Optional: Silence Sass deprecation warnings. See note below.
+ silenceDeprecations: [
+ 'mixed-decls',
+ 'color-functions',
+ 'global-builtin',
+ 'import'
+ ]
+ }
+ }
}
]
}
Here's a recap of why we need all these loaders. `style-loader` injects the CSS into a `<style>` element in the `<head>` of the HTML page, `css-loader` helps with using `@import` and `url()`, `postcss-loader` is required for Autoprefixer, and `sass-loader` allows us to use Sass.
+ **Note:** Sass deprecation warnings are shown when compiling source Sass files with the latest versions of Dart Sass. This does not prevent compilation or usage of Bootstrap. We're [working on a long-term fix]({{< param repo >}}/issues/40962), but in the meantime these deprecation notices can be ignored.
+
2. **Now, let's import Bootstrap's CSS.** Add the following to `src/scss/styles.scss` to import all of Bootstrap's source Sass.
```scss