Diagnosing PostCSS Plugins That Leave CSS Unchanged
CSS passes through PostCSS unchanged? Find missing plugins, wrong execution order, or config discovery failures with this diagnostic guide.
26 Aug 2026, 07:08 UTC

Recognizable condition
You install a PostCSS plugin, add it to your configuration, and rebuild. The output CSS still contains syntax the plugin should have transformed—for example, nested rules remain nested, or custom properties appear as --var declarations instead of resolved values. In some cases, the output is identical to the input, as if PostCSS did nothing at all.
Useful takeaway: this is usually a configuration discovery, plugin ordering, or build-tool integration problem, not a broken plugin. The plugin may be installed but never executed, or it may run too late to affect the output.
Cause and diagnostic table
| Symptom | Likely cause | First check |
|---|---|---|
| No CSS changes at all | PostCSS config is not discovered or the plugins array is empty | Run the PostCSS CLI against the project config |
| Plugin-specific syntax remains unchanged | Plugin is missing from the plugins array or not installed | Inspect the resolved plugin list |
| Some transforms work, others do not | Incorrect plugin execution order | Compare order against plugin dependencies |
| Transforms work in CLI but not in the dev server | Build tool is using a different config or caching an old one | Verify the integration's config path and restart the server |
Ordered checks
1. Reproduce the problem outside the build tool
Run the PostCSS CLI directly on a sample CSS file using your project's configuration. This isolates PostCSS from webpack, Vite, Next.js, or another bundler.
npx postcss src/styles.css --config postcss.config.js --output /tmp/out.css
Where to run: terminal at the project root. Required permissions: read access to the source file and config; write access to the output path. Placeholders: replace src/styles.css with your input file, postcss.config.js with your config file name, and /tmp/out.css with a temporary output path.
Expected check: open /tmp/out.css. If the transform appears here, PostCSS and the plugin work; the problem is in the build tool integration. If the syntax is still unchanged, the problem is in the config or plugin list.
Risk: the command overwrites the output file if it already exists. It does not modify your source CSS.
2. Inspect the resolved plugin list
Create a temporary configuration that logs the CSS at each stage so you can confirm which plugins are active and in what order.
const log = (label) => () => (root) => {
console.log(`DEBUG ${label}:`, root.toString().slice(0, 120));
};
module.exports = {
plugins: [
log('start'),
require('postcss-nesting'),
log('after nesting'),
require('autoprefixer'),
log('end'),
],
};
Run the CLI with this config:
npx postcss src/styles.css --config postcss.debug.config.js --output /tmp/out.css
Expected check: the console shows the CSS changing after the plugin that should transform it. If a plugin name is missing from the log output, it is not in the pipeline. If the CSS does not change after a plugin runs, that plugin is not matching your input or is misconfigured.
Risk: delete postcss.debug.config.js after debugging. Do not commit it.
3. Confirm config discovery
PostCSS looks for configuration in several places, including postcss.config.js, postcss.config.mjs, .postcssrc.json, and the postcss key in package.json. If the file name or extension is unsupported, or if the build tool cannot parse it, PostCSS applies no plugins.
If your package.json contains "type": "module", a postcss.config.js file is treated as ES modules. Using require inside it will throw. Rename the file to postcss.config.cjs or rewrite it with export default.
Expected check: run ls postcss.config* and inspect package.json for "type" and any postcss key. Confirm the file you edited is the file the tool loads.
4. Verify plugin execution order
PostCSS runs plugins in array order. Transforms that generate new CSS must run before plugins that consume that output. For example, postcss-import should run before postcss-custom-properties if imported files use custom properties, and both should run before autoprefixer or cssnano, which are output-oriented.
Expected check: open your config and confirm dependency-aware plugins appear earlier than minifiers and prefixers.
5. Confirm the build tool is using the config
If the CLI works but the dev server output is unchanged, the integration is not loading your config. postcss-loader, Vite, and Next.js each resolve PostCSS configuration differently. postcss-loader may need config: { path: __dirname }; Vite usually discovers postcss.config.js at the project root; Next.js applies PostCSS only to CSS imported through its pages or app router.
Expected check: restart the dev server after any config change. PostCSS configuration is typically cached at startup.
Fixes tied to findings
- Missing plugin: install it and add it to the plugins array.
Then editnpm install -D postcss-nestingpostcss.config.js:module.exports = { plugins: [ require('postcss-nesting'), require('autoprefixer'), ], }; - Wrong order: reorder the array so generators run before consumers. Put
cssnanoandautoprefixerlast. - Config not discovered: use a supported file name and extension. If
package.jsonhas"type": "module", use.cjsfor CommonJS configs or switch to ESM syntax. - Build tool mismatch: point the integration at the config file explicitly, then restart the dev server.
Rollback: remove the temporary debug configuration file and restore any previous config file from version control. No build state is permanently changed by editing text configuration.
Escalation criteria
- If the CLI transforms CSS correctly but the build tool does not, the issue is in the build-tool integration, not PostCSS itself. Check the integration's documentation and config-path option.
- If the CLI also fails after you confirm the plugin is installed and ordered correctly, check the plugin's peer dependencies and PostCSS version compatibility in
package.json. - If multiple developers see different results, compare
node_modulesversions and lockfiles; a hoisted or duplicated PostCSS installation can load an unexpected plugin copy.
Limitations and verification
This guide covers established PostCSS configuration behavior. ESM config support depends on your Node version and the build tool, so test the exact file your tool loads. The debug plugin technique adds console output and should not be committed.
Practical verification: run the CLI command from check 1 before and after your fix. Compare /tmp/out.css against the input. If the expected syntax is gone and no new errors appear, the pipeline is working. Then restart the dev server and confirm the built output matches.