A Babel plugin (v1.0.0) that minifies CSS code embedded in template literals at build time. It identifies template literals prefixed with a `/* css */` comment and applies CSS minification using an internal minifier. Minimal configuration: just add to Babel plugins list. Different from runtime CSS-in-JS solutions, this operates at compile time with zero runtime overhead. Requires Node >=12 and a Babel environment. No updates since initial release — considered stable but low maintenance.
npm install babel-plugin-template-css-minifierNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates setup with Babel config and CSS template minification from input to output.
In your Babel config, list this plugin before any other plugin that modifies template literals.
Ensure every CSS template literal has the `/* css */` comment directly before it (no newline).
Run a separate CSS validator before the Babel step, or ensure source CSS is correct.
Enable Babel source maps (sourceMaps: true) and test that CSS line numbers correlate correctly.
Correct the CSS syntax. The plugin uses a simple minifier that expects valid CSS.
Move this plugin earlier in the plugins array, before any plugin that transforms template literals.
Ensure the comment is directly before the backtick without any whitespace or other tokens.
No dependency data recorded yet.