Search code examples
sveltesapper

Why Sapper omits clossing HTML tags?


When I clone the official Sapper template, install dependencies and export it

~$ degit "sveltejs/sapper-template#webpack" sapper-template
~$ cd sapper-template/
~/sapper-template$ npm install
~/sapper-template$ npm run export

and then inspect the generated index.html, the closing </body> and </html> tags are absent.

...
<body>
    ...
    <script src=/client/4def89e12e93fe68fd0d/main.js> </script>
// EOF

Why does Sapper generate formally invalid HTML?


Solution

  • This issue has been discussed on the sapper repository here: :https://github.com/sveltejs/sapper/issues/1061

    In that issue there is a link to the HTML standard about tag emissions: https://html.spec.whatwg.org/dev/syntax.html#syntax-tag-omission

    The conclusion is that, while it might look strange, it's a perfectly valid html