<!doctypehtml>
See original GitHub issueHi all,
Trying in this tool : https://kangax.github.io/html-minifier/
I tried minimizing the source-code of that same page. The minimized code does not validate.
Particularily, the <!DOCTYPE html>
is reduced to <!doctypehtml>
, which is not okay.
To reproduce:
- Copy this minimal HTML code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Page</title>
</head>
<body>
<div class="mydiv">Stuff</div>
</body>
</html>
- paste it on that same page
- minify it
- try to validate the minified code.
Result:
Minified code is
<!doctypehtml><html lang=en><meta charset=UTF-8><title>Page</title><div class=mydiv>Stuff</div>
Which is not valid:
Error: Missing space before doctype name. At line 1, column 10
Expectation:
Minified code should be valid, ie be atleast this:
<!doctype html><html lang=en><meta charset=UTF-8><title>Page</title><div class=mydiv>Stuff</div>
End notes
This is the only error on my minimal HTML code example. If you try minifying the HTML of the online tool itself, you’ll find another error, most similar.
Appart from that it seems to do the job. Thanks for that all!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:17
Top Results From Across the Web
HTML doctype declaration - W3Schools
All HTML documents must start with a <!DOCTYPE> declaration. The declaration is not an HTML tag. It is an "information" to the browser...
Read more >: It's Code For Declaring A DOCTYPE In HTML5 »
All HTML need to have a DOCTYPE declared. The DOCTYPE is not actually an element or HTML tag. It lets the browser know...
Read more >Doctype - MDN Web Docs Glossary: Definitions of ... - Mozilla
In HTML, the doctype is the required " <!DOCTYPE html> " preamble found at the top of all documents. Its sole purpose is...
Read more >HTML: <!DOCTYPE> tag - TechOnTheNet
The HTML <!DOCTYPE> tag is the very first line in the HTML document. It tells the browser what version of HTML the document...
Read more >Recommended list of Doctype declarations you can ... - W3C
Recommended Doctype Declarations to use in your Web document. ... When authoring document is HTML or XHTML, it is important to Add a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d beg to differ (largely because of the current shape of frontend dev) but it’s an interesting conversation to be had. Probably not here though?
Yeah, but it’s unsafe and we do have other unsafe options disabled by default. Disabling
removeTagWhitespace
on the website too brings things on par with the CLI 😃