nunjucks-minify-loaders

Passing source from loader via html-minifier

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
nunjucks-minify-loaders
541.0.25 years ago7 years agoMinified + gzip package size for nunjucks-minify-loaders in KB

Readme

Nunjucks minifier loader
Simple module to passing source from loader via HTML minifier.
Installation
npm install nunjucks-minify-loaders
Using
var nunjucks = require('nunjucks');
var FileMinifyLoader = require('nunjucks-minify-loaders').FileMinifyLoader;
 
var opts = {
    // FileSystemLoader 
    watch: true,
    noCache: false,

    // html-minifier 
    minify: {
        removeComments: true,
        minifyJS: true,
    }
};

var loader = new FileMinifyLoader('./views', opts);
var env = new nunjucks.Environment(loader);

// Now every loaded templates from ./views will be handled via html-minifier

More about HTML-minifier