A Nunjucks add-on (v1.0.2, latest) that passes template source through html-minifier before rendering. It wraps Nunjucks' built-in loaders (e.g., FileSystemLoader) to minify HTML output automatically. Different from standalone minification by integrating directly into the template loading pipeline. No active updates since initial release.
npm install nunjucks-minify-loadersNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a Nunjucks environment with a FileMinifyLoader that minifies templates using html-minifier options.
If you need other loaders, extend the class or use a different minification approach.
Ensure options are under 'minify' key, e.g., { minify: { removeComments: true } }.Use @types/nunjucks and define your own types or use plain JavaScript.
Use const { FileMinifyLoader } = require('nunjucks-minify-loaders');Run npm install html-minifier --save
Ensure first argument is a valid Nunjucks loader path or a loader instance, and options contain minify configuration.