Template examples
content-sass

content-custom-font

CSS capabilities
| Capability | What it gives you |
|---|---|
| Multi-context styling | Use one authoring model for pages and content scripts |
| Sass/Less compilation | Compile Sass/Less when dependencies are present |
| Context-aware output | Emit page CSS and content-script CSS to correct targets |
| Dev update flow | Apply style updates through hot module replacement (HMR)/remount when supported |
Where to reference CSS
manifest.json(content_scripts[].css)- HTML files (
<link rel="stylesheet" href="...">) - Script imports (
import "./styles.css", including Sass/Less when enabled)
CSS support
Manifest CSS entries:| Manifest field | File type expected |
|---|---|
content_scripts.css | .css, .scss, .sass, .less |
Example: CSS in manifest.json
Example: CSS in extension page scripts
Output behavior by context
| Context | Output behavior |
|---|---|
| HTML/page contexts | Extension.js bundles CSS with page entries (feature.css) |
| Content scripts | Extension.js emits CSS as content_scripts/[name].[contenthash:8].css assets |
Development behavior
- Content script CSS imports participate in the content-script HMR/remount flow.
- Extension.js adds a dev helper script to CSS-only content script entries so it can propagate updates.
- Page CSS follows normal page HMR pipeline behavior.
- Structural manifest/content-script changes can still require full extension reload or restart.
Modules and preprocessors
- CSS modules work best in extension page contexts.
- Extension.js enables Sass/Less support when you install the related dependencies.
- If a project references
.scss/.lessfiles but the preprocessor is not installed, the build warns and ships the stylesheet as plain CSS instead of failing, matching how the browser loads whatever CSS it receives. Install the preprocessor to get real compilation. - Extension.js runs PostCSS automatically when it detects a PostCSS configuration in your project, or when you configure it explicitly.
Best practices
- Keep content-script styles intentionally scoped to reduce host-page collisions.
- Prefer component-local module styles for extension page UIs.
- Keep preprocessor and PostCSS configurations explicit to avoid unintended changes to your build setup over time.
- Validate CSS paths referenced by manifest fields in continuous integration (CI).
Next steps
- Understand update outcomes in dev update behavior.
- Learn more about CSS modules.
- Learn more about PostCSS integration.

