A Rollup plugin that processes CSS template literals (including LitElement's css tag) through PostCSS. Current stable version is 1.3.0. The plugin iterates over all matched JavaScript/TypeScript files, extracts CSS template literals, and runs them through PostCSS with user-provided plugins. It supports custom tag names (e.g., 'css'), include/exclude globs, and works with Vite. Unlike related plugins, it leverages PostCSS's plugin ecosystem, making it extensible for minification (cssnano), Tailwind CSS v4, Autoprefixer, and more. Peer dependency on postcss ^8.4.40. Ship TypeScript types.
npm install rollup-plugin-template-postcssNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic Rollup config using rollup-plugin-template-postcss with cssnano to minify CSS template literals in LitElement components.
Update your configuration to match the documented options in v1.3.0 README.
Change tags: 'css' to tags: ['css']
Ensure your CSS template literals are tagged: e.g., import { css } from 'lit'; const styles = css`...`;Change import statement to import { templatePostcss } from 'rollup-plugin-template-postcss'Use a tagged template literal: import { css } from 'lit'; const styles = css`...`; Or set tags: ['css', 'myTag'] if using custom tag.Run npm install --save-dev postcss
Use import { templatePostcss } from 'rollup-plugin-template-postcss' in an ESM context or configure Rollup for ESM.Use import { templatePostcss } from 'rollup-plugin-template-postcss'