Registry / testing / karma-htmlmin-preprocessor

karma-htmlmin-preprocessor

JSON →
library0.1.0jsnpmunverified

Karma preprocessor plugin that minifies HTML files using html-minifier before they are served to the browser. Version 0.1.0 is the only release (2014), no longer maintained. Useful when combined with other preprocessors like karma-ng-html2js-preprocessor to reduce HTML file size in AngularJS directive templates. Note that this plugin only defines the 'htmlMin' preprocessor; actual minification behavior is controlled via the htmlMinPreprocessor configuration object, which passes options to html-minifier. Requires Karma ~0.10 but may work with newer versions.

npm install karma-htmlmin-preprocessor
INSTALL
IMPORT
SIG · KARMA-HTMLMIN-PREP
K
karma-htmlmin-preprocessor
testingjavascriptv0.1.0
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.

htmlMinPreprocessor
module.exports = function(config) { config.set({ preprocessors: { '**/*.html': ['html-min'] }, htmlMinPreprocessor: { collapseWhitespace: true } }); };
No wrong import; plugin is configured in karma.conf.js.
This is not a JavaScript import; it's a Karma configuration. The plugin registers itself as a framework when installed.

Install karma-htmlmin-preprocessor and configure it in karma.conf.js to minify HTML files before testing.

npm install karma karma-htmlmin-preprocessor html-minifier --save-dev // karma.conf.js module.exports = function(config) { config.set({ files: ['src/**/*.html'], preprocessors: { '**/*.html': ['html-min'] }, htmlMinPreprocessor: { collapseWhitespace: true, removeComments: true } }); };
Debug
Known issues
deprecatedPackage has only one release (0.1.0) and no updates since 2014. It is effectively abandoned.
fix
Consider using modern alternatives like karma-html2js-preprocessor with minification built-in or custom preprocessors.
affects: 0.1.0
gotchaThe plugin expects html-minifier to be installed as a peer dependency, but it is not listed in package.json. You must install it separately.
fix
Run `npm install html-minifier --save-dev` alongside this package.
affects: 0.1.0
gotchaThe preprocessor name in the config is 'html-min', not 'htmlmin' or 'htmlmin-preprocessor'.
fix
Use 'html-min' as the preprocessor name in `preprocessors`.
affects: 0.1.0
Errors
Common errors & fixes
Error: No provider for "preprocessor:html-min"!
The karma-htmlmin-preprocessor package is not installed or not loaded.
fix
Run `npm install karma-htmlmin-preprocessor --save-dev` and check that it is in devDependencies.
Error: Cannot find module 'html-minifier'
html-minifier is a peer dependency but not installed.
fix
Run `npm install html-minifier --save-dev`.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
karmarequiredThis plugin is a Karma preprocessor and requires Karma to run tests.
html-minifierrequiredThe plugin uses html-minifier to minify HTML files.
Agent activity
2 hits · last 30 days
node
2
Resources
karma-htmlmin-preprocessor — npm install karma-htmlmin-preprocessor · libregistry