Registry / devops / pattern-lab-minify-html

pattern-lab-minify-html

JSON →
library1.1.1jsnpmunverified

A plugin for Pattern Lab Node that minifies and beautifies generated HTML templates using html-minifier and js-beautify. Version 1.1.1 is current. Helps reduce production code size and prevent HTML errors like empty attributes. Integrates automatically with patternlab-config.json. Released under MIT license.

npm install pattern-lab-minify-html
INSTALL
IMPORT
SIG · PATTERN-LAB-MINIFY
P
pattern-lab-minify-html
devopsjavascriptv1.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Configuration example for enabling the plugin with minify and beautify options.

// No programmatic imports; configuration is done via patternlab-config.json // Example patternlab-config.json plugin section: // "plugins": { // "pattern-lab-minify-html": { // "enabled": true, // "initialized": false, // "options": { // "minify": { // "removeEmptyAttributes": true, // "collapseWhitespace": true, // "removeComments": true // }, // "beautify": { // "indent_size": 4, // "end_with_newline": true // }, // "pluginOptions": { // "verbose": false // } // } // } // }
Debug
Known issues
gotchaThe plugin relies on a peer dependency: patternlab-node. Ensure patternlab-node is installed in your project.
fix
Install patternlab-node: `npm install patternlab-node`
affects: >=1.0.0
gotchaThe 'initialized' field in config may be false after install; run npm run postinstall if automatic initialization fails.
fix
Run `npm run postinstall` in your project root.
affects: >=1.0.0
gotchaSetting 'minify' or 'beautify' option to false disables that transformation but may still cause plugin to process and output unchanged content. The plugin is enabled/disabled via 'enabled' flag.
fix
To fully disable, set 'enabled' to false instead of setting options to false.
affects: >=1.0.0
deprecatedThe plugin named 'plugin-node-minify-html' in patternlab-config.json is deprecated; use 'pattern-lab-minify-html' key as installed.
fix
Use the key 'pattern-lab-minify-html' in plugins object.
affects: >=1.1.0
gotchaCommon mistake: placing plugin config directly under 'plugins' array incorrectly; it must be an object keyed by the plugin name.
fix
Use: "plugins": { "pattern-lab-minify-html": { ... } }
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'patternlab-node'
patternlab-node is a peer dependency not installed.
fix
Run `npm install patternlab-node --save-dev`
TypeError: Cannot read property 'options' of undefined
Plugin configuration missing or improperly formatted in patternlab-config.json.
fix
Ensure patternlab-config.json has a 'plugins' object with correct key and options.
The plugin 'pattern-lab-minify-html' is not initialized. Run 'npm run postinstall'
Postinstall script not executed after npm install.
fix
Run `npm run postinstall` from your project root.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies
html-minifierrequiredUsed for HTML minification with configurable options such as removeEmptyAttributes, collapseWhitespace, etc.
js-beautifyrequiredUsed for HTML beautification with options like indent_size, end_with_newline, etc.
patternlab-noderequiredPeer dependency; this plugin is designed to extend Pattern Lab Node's build process.
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
pattern-lab-minify-html — npm install pattern-lab-minify-html · libregistry