mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Move html-minifier use to lodash.github.io.
This commit is contained in:
@@ -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>[^<]+<\/span>){2,}/g, match =>
|
||||
match.replace(/<\/?span>/g, '')
|
||||
));
|
||||
});
|
||||
|
||||
const html = [
|
||||
// Append YAML front matter.
|
||||
'---',
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user