How to use html-minifier-terser - 4 common examples

To help you get started, we’ve selected a few html-minifier-terser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DanielRuf / html-minifier-terser / assets / master.js View on Github external
return function(value, options, callback, errorback) {
      options.log = function(message) {
        console.log(message);
      };
      var minified;
      try {
        minified = minify(value, options);
      }
      catch (err) {
        return errorback(err);
      }
      callback(minified);
    };
  })();
github DanielRuf / html-minifier-terser / assets / worker.js View on Github external
addEventListener('message', function(event) {
    try {
      var options = event.data.options;
      options.log = function(message) {
        console.log(message);
      };
      postMessage(minify(event.data.value, options));
    }
    catch (err) {
      postMessage({
        error: err + ''
      });
    }
  });
  postMessage(null);
github makuga01 / dnsFookup / FE / node_modules / html-webpack-plugin / index.js View on Github external
postProcessHtml (html, assets, assetTags) {
    if (typeof html !== 'string') {
      return Promise.reject(new Error('Expected html to be a string but got ' + JSON.stringify(html)));
    }
    const htmlAfterInjection = this.options.inject
      ? this.injectAssetsIntoHtml(html, assets, assetTags)
      : html;
    const htmlAfterMinification = typeof this.options.minify === 'object'
      ? require('html-minifier-terser').minify(htmlAfterInjection, this.options.minify)
      : htmlAfterInjection;
    return Promise.resolve(htmlAfterMinification);
  }
github gpoitch / ember-cli-html-minifier / index.js View on Github external
HtmlMinifierFilter.prototype.processString = function(string) {
  return minify(string, this.minifierOptions);
};

html-minifier-terser

Highly configurable, well-tested, JavaScript-based HTML minifier.

MIT
Latest version published 2 years ago

Package Health Score

77 / 100
Full package analysis

Popular html-minifier-terser functions