Rollup plugin to process HTML files using PostHTML. Current stable version is 1.1.0 (released sporadically, no fixed cadence). It integrates PostHTML into the Rollup build pipeline, allowing HTML transformation via PostHTML plugins. Unlike generic HTML loaders, it passes options directly to PostHTML's .process method, supports include/exclude patterns, and can emit files as Rollup assets. Suitable for projects that need to transform HTML with PostHTML plugins during Rollup bundling.
npm install rollup-plugin-posthtmlVerified import paths — ran on the pinned version, not inferred.
Example Rollup config using rollup-plugin-posthtml with custom PostHTML plugins and include pattern.
Consult PostHTML documentation for valid options; do not pass Rollup plugin options like 'output' to the options object.
Ensure your HTML files are imported or use Rollup's plugin configuration to handle them as entry points.
Upgrade to v1.1.0 and remove custom emit logic; use the plugin's built-in file emission.
Set option 'emit: false' if you do not want automatic file emission.
Install the PostHTML plugin: npm install posthtml-include --save-dev
Use default import: import rollupPluginPosthtml from 'rollup-plugin-posthtml'
Wrap plugins in an object: rollupPluginPosthtml({ plugins: [...] })