voku/HtmlMin

html tag for AMP is modifed incorrectly

scones opened this issue · 5 comments

What is this feature about (expected vs actual behaviour)?

To use AMP properly, one has to use a specific html tag
<html ⚡>

unfortunately HtmlMin removed the important bit, leaving only
<html>

How can I reproduce it?

run the minifier over a sample document with the tag sahown above

Does it take minutes, hours or days to fix?

depending on the source of the problem and how much you are into your code:
hours to days

Any additional information?

voku commented

thanks for the bug report, fixed in version 4.5.4 of the simple-dom-lib... but you can also use <html amp> like this https://amp.dev/documentation/guides-and-tutorials/start/create/basic_markup?format=websites

your fix now produced <html ____simple_html_dom__voku__google_amp____=true> which is invalid again

voku commented

I added a test case... 🤔 but maybe you are using the lib a different way, so can you share a minimal example or even better a pull request with a failed test? Thanks.

well, my config looks like in the example of the docu here:
https://github.com/vmpublishing/slim-html-minify

maybe it is a utf8 problem somewhere.
🤔

voku commented

my fault :/ ... I didn't tested it via HtmlMin (I only fixed and tested it via SimpleHtmlDom) but HtmlMin will remove the quotes from a helper string ...="true" vs. ...=true.

Fixed in version 3.1.8 of HtmlMin (f7256e7)