afbora / kirby-minify-html Goto Github PK
View Code? Open in Web Editor NEWEnable minify HTML output for Kirby 3 and 4
License: MIT License
Enable minify HTML output for Kirby 3 and 4
License: MIT License
On my side everything is working as expected. I only had a small piece of html (conditional comment) that wasn't minified.
To reproduce the "issue", place the following somewhere in your html:
<!--[if lt IE 9]>
<div class="browserUpdate">
<p>Bro, don't you think it's time to upgrade to a real browser? </p>
<p><a href="http://browsehappy.com/" target="_blank">UPDATE NOW</a> </p>
</div>
<![endif]-->
RESULT (after minification):
<!--[if lt IE 9]>
<div class="browserUpdate">
<p>Bro, don't you think it's time to upgrade to a real browser? </p>
<p><a href="http://browsehappy.com/" target="_blank">UPDATE NOW</a> </p>
</div>
<![endif]-->
EXPECTED (after minification):
<!--[if lt IE 9]><div class="browserUpdate"><p>Bro, don't you think it's time to upgrade to a real browser? </p><p><a href="http://browsehappy.com/" target="_blank">UPDATE NOW</a></p></div><![endif]-->
Hope it helps you make your plugin even BETTER :-)
Using Kirby 3.9 on PHP 8.2, this plugin returns the following error:
Using ${var} in strings is deprecated, use {$var} instead
Seems to be related to this issue voku/simple_html_dom#90.
Related issue voku/HtmlMin#93
.. and I can't figure out why! What could possible pitfalls be? On many other websites, I install it and it just worksTM - I tried var_dump
ing from inside the plugin, nothing - I don't even know if it's loaded - and if not, why ..
I appreciate all pointers,
cheers
S1SYPHOS
Will there be a compatible version for Kirby v4?
Hi Ahmet,
I want to use the doMakeSameDomainsLinksRelative
option and pass an array with domains to the minifier, like this:
'doMakeSameDomainsLinksRelative' => ['https://example.com'],
But using this option will lead to an TypeError:
"voku\helper\HtmlMin::doMakeSameDomainsLinksRelative(): Argument #1 ($localDomains) must be of type array, bool given ..."
What do you think? Could this be customized?
Thanks for your time and the great plugin.
Tim
On PHP 8, this extension throws the following error:
Whoops\Exception\ErrorException thrown with message "Function libxml_disable_entity_loader() is deprecated"
Stacktrace:
#9 Whoops\Exception\ErrorException in /Users/xyz/site/plugins/minify-html/vendor/voku/simple_html_dom/src/voku/helper/HtmlDomParser.php:311
#8 Whoops\Run:handleError in /Users/xyz/site/plugins/minify-html/vendor/voku/simple_html_dom/src/voku/helper/HtmlDomParser.php:311
#7 voku\helper\HtmlDomParser:createDOMDocument in /Users/xyz/site/plugins/minify-html/vendor/voku/simple_html_dom/src/voku/helper/HtmlDomParser.php:733
#6 voku\helper\HtmlDomParser:loadHtml in /Users/xyz/site/plugins/minify-html/vendor/voku/html-min/src/voku/helper/HtmlMin.php:1540
#5 voku\helper\HtmlMin:minifyHtmlDom in /Users/xyz/site/plugins/minify-html/vendor/voku/html-min/src/voku/helper/HtmlMin.php:1355
#4 voku\helper\HtmlMin:minify in /Users/xyz/site/plugins/minify-html/index.php:27
#3 MinifyHTML:render in /Users/xyz/kirby/src/Cms/Page.php:1172
#2 Kirby\Cms\Page:render in /Users/xyz/kirby/src/Cms/App.php:686
#1 Kirby\Cms\App:io in /Users/xyz/kirby/src/Cms/App.php:1039
#0 Kirby\Cms\App:render in /Users/xyz/index.php:5
We have an RSS feed on our side that we provide via a content representation: with this extension, the XML output is also minified which results in invalid markup.
Would it be possible to check the content type and only minify output that is explicitely HTML?
Hi,
Minifying works but unfortunately my comments are removed even though I added this to my config.php:
'afbora.kirby-minify-html.enabled' => true,
'afbora.kirby-minify-html.options' => [
'doOptimizeViaHtmlDomParser' => true,
'doRemoveComments' => false,
],
Am I missing something?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.