Transform CSS consistently across extension pages and content scripts with one pipeline. Use PostCSS when you need plugins like Autoprefixer or modern CSS transforms. Extension.js detects PostCSS configuration and appliesDocumentation Index
Fetch the complete documentation index at: https://extension.js.org/llms.txt
Use this file to discover all available pages before exploring further.
postcss-loader when needed.
When PostCSS is a good fit
- You need autoprefixing or modern CSS transforms in extension styles.
- You want one CSS transform pipeline across popup/options/sidebar/content scripts.
- You are using Tailwind or plugin-based style processing.
PostCSS capabilities
| Capability | What it gives you |
|---|---|
| Shared CSS pipeline | Use the same transforms across popup, options, new tab, and content scripts |
| Flexible config discovery | Load PostCSS config from dedicated files or package.json |
| Tailwind compatibility | Works with Tailwind-based setups through PostCSS plugins |
| Plugin-based transforms | Add tools like autoprefixer and postcss-preset-env |
Template examples
Tailwind + PostCSS starter
Use this template when you want a working PostCSS setup with Tailwind and component-driven UI.
Detection and configuration files
Extension.js checks these PostCSS configuration files:.postcssrc.postcssrc.json.postcssrc.yaml.postcssrc.ymlpostcss.config.mjs.postcssrc.js/.postcssrc.cjspostcss.config.js/postcss.config.cjs
postcss configuration in package.json.
Using PostCSS with an existing extension
Install PostCSS dependencies:Create postcss.config.js
Usage
Import styles normally in extension pages:css pipeline for pages, asset pipeline for content scripts).
Tailwind interaction
- Extension.js can trigger PostCSS setup automatically when it detects Tailwind.
- Extension.js handles both Tailwind v3 and v4, selecting plugins based on the detected version.
- In ECMAScript Module (ESM) projects with incompatible CommonJS (CJS) PostCSS configuration patterns, Extension.js may bypass your configuration. It injects compatibility plugins instead.
Best practices
- Keep plugin chains small and explicit (for example,
autoprefixer,postcss-preset-env). - Verify configuration format (
.mjs/.cjs) matches your project module type. - Keep Tailwind and PostCSS versions aligned to avoid plugin resolution mismatches.
- Prefer shared style entry files for predictable processing across extension surfaces.
Next steps
- Configure Tailwind CSS with PostCSS.
- Add stylesheet linting with Stylelint.

