Dabolus/polymer3-webpack-starter-kit

View on GitHub
conf/webpack/custom-loaders/minify-template.loader.js

Summary

Maintainability
A
0 mins
Test Coverage
const {minify} = require('html-minifier');

module.exports = (src) =>
  src.replace(
    /`(\s*<[a-z](?:[^`\\]|\\.)*>\s*)`/gi,
    (template, html) => `\`${minify(html, {
      collapseWhitespace: true,
      removeComments: true,
      removeRedundantAttributes: true,
      removeScriptTypeAttributes: true,
      removeStyleLinkTypeAttributes: true,
      sortAttributes: true,
      sortClassName: true,
      useShortDoctype: true,
      minifyCSS: true,
      minifyJS: true,
    })}\``,
  );