UNPKG

464 BJavaScriptView Raw
1"use strict";
2
3const HtmlMinifier = require('html-minifier').minify;
4
5module.exports = function(code) {
6 code = HtmlMinifier(code, {
7 caseSensitive: true,
8 collapseInlineTagWhitespace: true,
9 collapseWhitespace: true,
10 decodeEntities: true,
11 includeAutoGeneratedTags: false,
12 keepClosingSlash: true,
13 trimCustomFragments: true,
14 });
15
16 return code
17 .replace(/<zc-space ?\/>/g, ' ')
18 .replace(/<zc-newline ?\/>/g, '\n')
19 .replace(/<zc-tab ?\/>/g, '\t');
20};
\No newline at end of file