How to use koa-html-minifier - 2 common examples

To help you get started, we’ve selected a few koa-html-minifier 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 kiki-le-singe / react-redux-universal-boilerplate / src / server / koa.prod.js View on Github external
import handleRender from 'server/utils/render'
import projectConfig, { paths } from '../../config'

const debug = _debug('app:server:prod')
const app = new Koa()
const { SERVER_HOST, SERVER_PORT } = projectConfig

app.use(helmet())

app.use(compress({
  threshold: 2048,
  flush: require('zlib').Z_SYNC_FLUSH
}))

app.use(convert(htmlMinifier({
  caseSensitive: true,
  // removeComments: true,
  removeCommentsFromCDATA: true,
  removeCDATASectionsFromCDATA: true,
  collapseWhitespace: true,
  collapseBooleanAttributes: true,
  collapseInlineTagWhitespace: true,
  removeAttributeQuotes: true,
  removeRedundantAttributes: true,
  removeScriptTypeAttributes: true,
  removeStyleLinkTypeAttributes: true,
  useShortDoctype: true,
  removeEmptyAttributes: true,
  removeOptionalTags: true,
  minifyJS: true,
  minifyCSS: true,
github UXtemple / panels / server / index.es6 View on Github external
export default function createServer({apps=[], heapId}) {
  const server = koa();

  apps.forEach(app => server.use(serve(`${app}/public`)));
  server.use(serve(`${__dirname}/../public`));
  server.use(logger());
  server.use(compress());
  server.use(htmlMinifier({collapseWhitespace: true}));
  server.use(panels({heapId, prerender: !!process.env.PRERENDER}));

  return server;
}

koa-html-minifier

minify HTML responses like some crazy guy

MIT
Latest version published 3 years ago

Package Health Score

49 / 100
Full package analysis

Popular koa-html-minifier functions