Registry / devops / gitbook-plugin-html-minifier

gitbook-plugin-html-minifier

JSON →
library0.0.1jsnpmunverified

A GitBook plugin that automatically minifies HTML output after the build process, using html-minifier under the hood. Current version 0.0.1 with no active releases. This plugin is specific to GitBook >1.x.x and provides configurable minification options such as collapsing whitespace, removing comments, and minifying inline CSS/JS. It is a straightforward integration for GitBook users seeking to reduce HTML file size, but lacks version updates and may have limited compatibility with modern GitBook versions.

npm install gitbook-plugin-html-minifier
INSTALL
IMPORT
SIG · GITBOOK-PLUGIN-HTM
G
gitbook-plugin-html-minifier
devopsjavascriptv0.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (plugin)
Add to book.json plugins array
npm install globally or require in code
GitBook plugins are configured via book.json, not imported directly.
html-minifier (library)
const minify = require('html-minifier').minify;
import { minify } from 'html-minifier'; (ESM not supported in GitBook context)
The plugin uses html-minifier internally; not for direct use.

Shows how to install and configure the GitBook HTML minifier plugin via book.json with common options.

// 1. Install the plugin // npm install gitbook-plugin-html-minifier // 2. Add to book.json { "plugins": ["html-minifier"], "pluginsConfig": { "html-minifier": { "collapseWhitespace": true, "removeComments": true, "minifyCSS": true, "minifyJS": true } } } // 3. Build your GitBook // gitbook build // Output HTML files will be minified.
Debug
Known issues
deprecatedGitBook plugin ecosystem is deprecated in favor of GitBook v3+ with different plugin architecture
fix
Switch to GitBook v3+ or use alternative minification approach (e.g., post-build script).
affects: >=0.0.1
gotchaPlugin version 0.0.1 may not work with GitBook versions >2.x due to breaking changes
fix
Check GitBook version compatibility; consider pinning to GitBook 1.x or use a different plugin.
affects: 0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'html-minifier'
Missing dependency; npm install did not include all dependencies.
fix
Run 'npm install gitbook-plugin-html-minifier' which should install html-minifier as a dependency.
TypeError: Cannot read property 'minify' of undefined
Plugin's internal require fails; often due to npm dedupe issues or missing html-minifier.
fix
Ensure html-minifier is installed: 'npm install html-minifier' alongside the plugin.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies
html-minifierrequiredCore minification engine
gitbookrequiredGitBook plugin ecosystem dependency (peer)
Agent activity
2 hits · last 30 days
node
2
Resources
gitbook-plugin-html-minifier — npm install gitbook-plugin-html-minifier · libregistry