diff --git a/lib/main/build-site.js b/lib/main/build-site.js index f1ea66a3e..69a45e6e7 100644 --- a/lib/main/build-site.js +++ b/lib/main/build-site.js @@ -96,37 +96,19 @@ function build(type) { // Unwrap elements containing only text. $('.highlight :not([class])').each(function() { - const $el = $(this); - if (_.every($(el).children(), ['type', 'text'])) { + let $el = $(this); + while ($el[0] && _.every($el.children(), ['type', 'text'])) { $el.replaceWith($el.text()); + $el = $el.parent(); } }); - // Consolidate hightlights comments. + // Collapse hightlights comments. $('.highlight [class~="comment"] > [class~="comment"]').each(function() { const $parent = $(this).parent(); $parent.text($parent.text()); }); - // Minify hightlights snippets. - $('.highlight').each(function() { - const $div = $(this); - $div.html(minify($div.html(), { - 'collapseBooleanAttributes': true, - 'collapseInlineTagWhitespace': true, - 'collapseWhitespace': true, - 'removeAttributeQuotes': true, - 'removeComments': true, - 'removeEmptyAttributes': true, - 'removeEmptyElements': true, - 'removeOptionalTags': true, - 'removeRedundantAttributes': true - }) - .replace(/(?:[^<]+<\/span>){2,}/g, match => - match.replace(/<\/?span>/g, '') - )); - }); - const html = [ // Append YAML front matter. '---', diff --git a/package.json b/package.json index 997ed51f8..9cc09e303 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ "ecstatic": "^2.1.0", "fs-extra": "~0.30.0", "glob": "^7.0.6", - "html-minifier": "^3.0.2", "istanbul": "0.4.5", "jquery": "^3.1.0", "jscs": "^3.0.7",