Metalsmith plugin that bundles, minifies, and optimizes CSS from HTML files. It scans generated HTML for <link> and <style> tags, merges external and inline stylesheets by media query, and outputs either a single linked .min.css file per media type or inline <style> blocks. Version 0.5.0 wraps the csso minimizer. Use it when you need to process multiple CSS sources after HTML generation. Supports data-packer="exclude" attribute to skip certain elements. The plugin expects HTML files already built by Metalsmith; it does not handle SASS/SCSS compilation natively.
npm install metalsmith-css-packerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows a complete Metalsmith build with CSS packer configured to inline styles and disable CSS restructure.
Ensure your Metalsmith pipeline generates HTML before this plugin runs.
Use data-packer="exclude" on external links you do not want fetched.
Set a unique outputPath option to avoid conflicts.
Use only documented options listed in the README.
Use .build(function(err) { ... }) instead of chaining .build().Ensure the HTML files are already built before this plugin.
Use a Metalsmith plugin pattern to process only .html files before this plugin.