feat(html): minify static and dynamic html output

This commit is contained in:
Cory Dransfeldt 2025-04-14 09:31:07 -07:00
parent b6d5933433
commit f4b6436460
No known key found for this signature in database
18 changed files with 305 additions and 7 deletions

View file

@ -133,3 +133,13 @@ schema: artist
<?php endforeach; ?>
</table>
</article>
<?php
$html = ob_get_clean();
$htmlMin = new HtmlMin();
$htmlMin->doOptimizeAttributes(true);
$htmlMin->doRemoveComments(true);
$htmlMin->doSumUpWhitespace(true);
$htmlMin->doRemoveWhitespaceAroundTags(true);
$htmlMin->doOptimizeViaHtmlDomParser(true);
echo $htmlMin->minify($html);
?>

View file

@ -64,3 +64,13 @@ schema: book
<?= parseMarkdown($book["description"]) ?>
<?php endif; ?>
</article>
<?php
$html = ob_get_clean();
$htmlMin = new HtmlMin();
$htmlMin->doOptimizeAttributes(true);
$htmlMin->doRemoveComments(true);
$htmlMin->doSumUpWhitespace(true);
$htmlMin->doRemoveWhitespaceAroundTags(true);
$htmlMin->doOptimizeViaHtmlDomParser(true);
echo $htmlMin->minify($html);
?>

View file

@ -40,3 +40,13 @@ schema: genre
<button data-toggle-button>Show more</button>
<?php endif; ?>
</article>
<?php
$html = ob_get_clean();
$htmlMin = new HtmlMin();
$htmlMin->doOptimizeAttributes(true);
$htmlMin->doRemoveComments(true);
$htmlMin->doSumUpWhitespace(true);
$htmlMin->doRemoveWhitespaceAroundTags(true);
$htmlMin->doOptimizeViaHtmlDomParser(true);
echo $htmlMin->minify($html);
?>

View file

@ -56,3 +56,13 @@ schema: movie
<?= $movie["description"] ?>
<?php endif; ?>
</article>
<?php
$html = ob_get_clean();
$htmlMin = new HtmlMin();
$htmlMin->doOptimizeAttributes(true);
$htmlMin->doRemoveComments(true);
$htmlMin->doSumUpWhitespace(true);
$htmlMin->doRemoveWhitespaceAroundTags(true);
$htmlMin->doOptimizeViaHtmlDomParser(true);
echo $htmlMin->minify($html);
?>

View file

@ -56,3 +56,13 @@ schema: show
<?= parseMarkdown($show["description"]) ?>
<?php endif; ?>
</article>
<?php
$html = ob_get_clean();
$htmlMin = new HtmlMin();
$htmlMin->doOptimizeAttributes(true);
$htmlMin->doRemoveComments(true);
$htmlMin->doSumUpWhitespace(true);
$htmlMin->doRemoveWhitespaceAroundTags(true);
$htmlMin->doOptimizeViaHtmlDomParser(true);
echo $htmlMin->minify($html);
?>