feat(html): minify static and dynamic html output
This commit is contained in:
parent
b6d5933433
commit
f4b6436460
18 changed files with 305 additions and 7 deletions
|
@ -3,6 +3,7 @@
|
|||
require __DIR__ . "/../../server/utils/init.php";
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use voku\helper\HtmlMin;
|
||||
|
||||
$requestUri = $_SERVER["REQUEST_URI"];
|
||||
$url = trim(parse_url($requestUri, PHP_URL_PATH), "/");
|
||||
|
@ -75,6 +76,8 @@
|
|||
$ogImage = htmlspecialchars($artist["image"] . "?class=w800", ENT_QUOTES, "UTF-8");
|
||||
$fullUrl = "https://www.coryd.dev" . $requestUri;
|
||||
|
||||
ob_start();
|
||||
|
||||
header("Cache-Control: public, max-age=3600");
|
||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 3600) . " GMT");
|
||||
?>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
require __DIR__ . "/../server/utils/init.php";
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use voku\helper\HtmlMin;
|
||||
|
||||
$requestUri = $_SERVER["REQUEST_URI"];
|
||||
$url = trim(parse_url($requestUri, PHP_URL_PATH), "/");
|
||||
|
@ -98,6 +99,8 @@
|
|||
$ogImage = htmlspecialchars($book["image"] . "?class=w800", ENT_QUOTES, "UTF-8");
|
||||
$fullUrl = "https://www.coryd.dev" . $requestUri;
|
||||
|
||||
ob_start();
|
||||
|
||||
header("Cache-Control: public, max-age=3600");
|
||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 3600) . " GMT");
|
||||
?>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
require __DIR__ . "/../../server/utils/init.php";
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use voku\helper\HtmlMin;
|
||||
|
||||
$requestUri = $_SERVER["REQUEST_URI"];
|
||||
$url = trim(parse_url($requestUri, PHP_URL_PATH), "/");
|
||||
|
@ -66,6 +67,8 @@
|
|||
$ogImage = htmlspecialchars($genre["artists"][0]["image"] . "?class=w800", ENT_QUOTES, "UTF-8");
|
||||
$fullUrl = "https://www.coryd.dev" . $requestUri;
|
||||
|
||||
ob_start();
|
||||
|
||||
header("Cache-Control: public, max-age=3600");
|
||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 3600) . " GMT");
|
||||
?>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
require __DIR__ . "/../../server/utils/init.php";
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use voku\helper\HtmlMin;
|
||||
|
||||
$requestUri = $_SERVER["REQUEST_URI"];
|
||||
$url = trim(parse_url($requestUri, PHP_URL_PATH), "/");
|
||||
|
@ -75,6 +76,8 @@
|
|||
$ogImage = htmlspecialchars($movie["backdrop"] . "?class=w800", ENT_QUOTES, "UTF-8");
|
||||
$fullUrl = "https://www.coryd.dev" . $requestUri;
|
||||
|
||||
ob_start();
|
||||
|
||||
header("Cache-Control: public, max-age=3600");
|
||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 3600) . " GMT");
|
||||
?>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
require __DIR__ . "/../../server/utils/init.php";
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use voku\helper\HtmlMin;
|
||||
|
||||
$requestUri = $_SERVER["REQUEST_URI"];
|
||||
$url = trim(parse_url($requestUri, PHP_URL_PATH), "/");
|
||||
|
@ -66,6 +67,8 @@
|
|||
$ogImage = htmlspecialchars($show["image"] . "?class=w800", ENT_QUOTES, "UTF-8");
|
||||
$fullUrl = "https://www.coryd.dev" . $requestUri;
|
||||
|
||||
ob_start();
|
||||
|
||||
header("Cache-Control: public, max-age=3600");
|
||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 3600) . " GMT");
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%- capture headerContent -%}
|
||||
<img class="icon" src="{{ globals.cdn_url }}{{ globals.avatar_header }}?class=w200&v={% appVersion %}" alt"{{ globals.site_name }}" />
|
||||
<img class="icon" src="{{ globals.cdn_url }}{{ globals.avatar_header }}?class=w200&v={% appVersion %}" alt="{{ globals.site_name }}" />
|
||||
<span>Cory</span> <span>Dransfeldt</span>
|
||||
{%- endcapture -%}
|
||||
<section class="main-title">
|
||||
|
|
|
@ -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);
|
||||
?>
|
||||
|
|
|
@ -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);
|
||||
?>
|
||||
|
|
|
@ -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);
|
||||
?>
|
||||
|
|
|
@ -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);
|
||||
?>
|
||||
|
|
|
@ -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);
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue