.less and .module.less.
When Less is a good fit
- You are migrating an existing Less-based web codebase.
- You want variables and nesting with low migration cost.
- You need module-scoped styles while keeping Less conventions.
Template examples
new-less

Usage with an existing extension
You can add Less support to an existing Extension.js project. Install the dependencies and start using Less in your extension.Installation
Install the required dependencies:Example usage in an HTML file
In extension pages (popup/options/new tab), import Less through your script entry:In a content_script file
Less modules
Scope class names locally with Less Modules, just like CSS Modules. This prevents global style conflicts by default.content-less-modules

Using Less modules in an existing extension
To enable Less Modules, rename your.less files to include .module.less. This enables automatic local scoping of class names.
Example usage
After renaming your Less file, you can import it into your scripts:React/Preact example usage
To use Less Modules in React or Preact, import your Less module and apply styles as you would in any React component:Vue example usage
In Vue, prefer single-file component (SFC) styles withlang="less" and module:
Svelte example usage
In Svelte, import Less module mappings and apply classes:Behavior notes
- In extension page contexts,
.module.lessexports class maps as expected. - In content scripts, Extension.js emits styles as CSS assets and injects them through the content-script style flow.
- If Less tooling is missing, Extension.js can install optional dependencies and ask for a restart.
Next steps
- Learn more about CSS modules.
- Configure PostCSS in your extension.

