Skip to content

HTML minification strips head tag and closing /body and /html tags #37

@bmcminn

Description

@bmcminn

Noticed that my HTML templates get a bit mangled unexpectedly where the <head>, and closing </body>, </html> tags get stripped out of the resulting template file.

<!-- ORIGINAL -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Document</title>
    <meta name="application-name" content="APP_NAME_HERE">
    <link rel="stylesheet" href="CDN_CSS_FILE_REFERENCE">
</head>
<body>
    <main id="app" role="main">

    </main>

    <script src="CDN_SCRIPT_FILE_REFERENCE"></script>
    <script src="CDN_SCRIPT_FILE_REFERENCE"></script>
    <script src="CDN_SCRIPT_FILE_REFERENCE"></script>
    <script src="LOCAL_SCRIPT_FILE_REFERENCE"></script>
</body>
</html>
<!-- MINIFIED (expanded for readability) -->
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta http-equiv=x-ua-compatible content="ie=edge">
<meta name=viewport content="width=device-width,initial-scale=1">
<title>Document</title>
<meta name=application-name content=APP_NAME_HERE>
<link rel=stylesheet href=CDN_CSS_FILE_REFERENCE>
<main id=app role=main>
</main>
<script src=CDN_SCRIPT_FILE_REFERENCE></script>
<script src=CDN_SCRIPT_FILE_REFERENCE></script>
<script src=CDN_SCRIPT_FILE_REFERENCE></script>
<script src=LOCAL_SCRIPT_FILE_REFERENCE></script>

Just tested the resulting markup in Chrome (v52) and FireFox (47/48) and it seems to recognize the markup just fine. Never seen this before and was curious if this was intended functionality? as it seems to heavily rely on browsers properly parsing these minimalistic files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions