Rollup plugin for generating critical CSS using the critical package. Version 1.0.15 is current. It integrates with Rollup build process to extract and inline critical CSS for pages defined by URLs or filesystem paths. Key differentiators: supports multiple pages, custom critical configuration, and optional inlining. Ships TypeScript types. Release cadence: occasional updates. Compared to alternatives like critters, this plugin is specifically designed for Rollup/Vite and offers more configuration flexibility.
npm install rollup-plugin-criticalNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic setup for rollup-plugin-critical to generate critical CSS for multiple pages.
Remove `minify` from criticalConfig; use an external minifier if needed.
Upgrade to v1.0.13 or later.
Use v1.0.13 or later for both ESM and CJS support.
Ensure your project can handle ESM. Use Node 14+ and set `type: module` in package.json if needed.
Do not provide `css` in criticalConfig; the plugin handles it.
Upgrade rollup-plugin-critical to v1.0.13+, or switch your project to ESM.
Update to v1.0.13+ or adjust your import path (e.g., require('rollup-plugin-critical/dist/index.js')).Use default import: `import PluginCritical from 'rollup-plugin-critical'`.