Registry / devops / html-remove-whitespace-plugin

html-remove-whitespace-plugin

JSON →
library0.0.3jsnpmunverified

A Webpack plugin that removes whitespace and comments from HTML files, specifically designed for Velocity template files where html-minifier fails. It strips HTML comments, inline JS/CSS comments, and replaces multiple spaces with single spaces. Version 0.0.3 is the current stable release, with no recent updates. It integrates with html-webpack-plugin and offers optional exclude/include patterns via regex.

npm install html-remove-whitespace-plugin
INSTALL
IMPORT
SIG · HTML-REMOVE-WHITES
H
html-remove-whitespace-plugin
devopsjavascriptv0.0.3
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.

HtmlRemoveWhitespacePlugin
const HtmlRemoveWhitespacePlugin = require('html-remove-whitespace-plugin');
import HtmlRemoveWhitespacePlugin from 'html-remove-whitespace-plugin';
Package does not export ESM; use CommonJS require.

Shows how to add HtmlRemoveWhitespacePlugin to a Webpack config with html-webpack-plugin.

const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlRemoveWhitespacePlugin = require('html-remove-whitespace-plugin'); module.exports = { plugins: [ new HtmlWebpackPlugin({ template: 'index.html' }), new HtmlRemoveWhitespacePlugin() ] };
Debug
Known issues
gotchaPlugin may break JavaScript strings containing '<!--' or similar patterns
fix
Ensure no HTML-like comments exist in inline scripts, or use exclude option.
affects: *
gotchaNo support for ESM imports; only CommonJS require works
fix
Use require() instead of import.
affects: *
Errors
Common errors & fixes
Cannot find module 'html-remove-whitespace-plugin'
Package not installed or misspelled
fix
Run npm install html-remove-whitespace-plugin --save-dev
TypeError: HtmlRemoveWhitespacePlugin is not a constructor
Using ESM import style (import ... from) instead of require
fix
Use const HtmlRemoveWhitespacePlugin = require('html-remove-whitespace-plugin');
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
html-remove-whitespace-plugin — npm install html-remove-whitespace-plugin · libregistry