Sass / Sass modules
Use Sass to scale extension styling with variables, nesting, and modules while keeping a single build workflow.
Extension.js supports .scss and .sass, plus module variants (.module.scss, .module.sass) through the Rspack-based style pipeline.
When Sass is a good fit
- Your design system already relies on Sass variables and mixins.
- You need modular styles for component-driven extension UIs.
- You want parity with existing Sass workflows in web applications.
Template examples
new-sass

Start a new-tab extension with Sass support already configured.
Repository: extension-js/examples/new-sass
Usage with an existing extension
You can integrate Sass with an existing Extension.js project by installing the necessary dependencies and configuring your files.
Installation
Install the required dependencies:
Example usage in an HTML file
In extension pages (popup/options/new tab), import Sass from your entry script:
Sass modules
Sass Modules allow you to scope styles locally, just like CSS Modules. You can use .module.scss or .module.sass to activate Sass Modules, which prevent naming conflicts in your stylesheets.
content-sass-modules

Use Sass Modules in content scripts when you need scoped styling for injected UI.
Repository: extension-js/examples/content-sass-modules
Using Sass modules in an existing extension
To enable Sass Modules, rename your Sass file to include .module.scss or .module.sass. This will automatically scope the styles to your component.
Example usage
After renaming your Sass file, import it into your script:
In the Sass file:
React/Preact example usage
Import the Sass module into your React or Preact component, and use the scoped class names:
Vue example usage
In Vue SFCs, prefer module styles with lang="scss":
Svelte example usage
In Svelte, import Sass module mappings and apply classes:
Behavior notes
- In extension pages,
.module.scssand.module.sassexport class maps for JS/TS imports. - In content scripts, Sass is emitted as CSS assets for injection rather than module export maps.
- If Sass tooling is missing, Extension.js may install optional dependencies and ask for a restart.
Next steps
- Learn more about CSS modules.
- Ensure stylesheet quality with Stylelint.
