Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

HTML output is incorrect using sapper export #1455

Closed
vndre opened this issue Aug 29, 2020 · 3 comments
Closed

HTML output is incorrect using sapper export #1455

vndre opened this issue Aug 29, 2020 · 3 comments
Labels

Comments

@vndre
Copy link

vndre commented Aug 29, 2020

Describe the bug
the index.html created using sapper export is missing </ body> and </ html> closing tags

Sapper v0.28.2

Here is an extract of my generated html file:

<body>
  <div id=sapper>
    <main class=svelte-18unutu>
    </main>
    <footer class=svelte-186b8as>
    </footer> 
  </div>
                        <script>__SAPPER__={baseUrl:"",preloaded:[void...
                        </script> <noscript> <img
                          src="https://www.facebook.com/tr?id=&ev=PageView&noscript=1" height=1
                          style=display:none width=1> </noscript>

--- END OF FILE

template.html:

<body>
	<!-- The application will be rendered inside this element,
	     because `src/client.js` references it -->
	<div id='sapper'>%sapper.html%</div>

	<!-- Sapper creates a <script> tag containing `src/client.js`
	     and anything else it needs to hydrate the app and
	     initialise the router -->
	%sapper.scripts%
	<noscript>
		<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=&ev=PageView&noscript=1" />
	</noscript>
</body>
</html>

To Reproduce
npx degit "sveltejs/sapper-template#rollup" my-app
cd my-app
npm i
npm run export

Expected behavior
file should end with expected closing tags

@Conduitry
Copy link
Member

Duplicate of #1061, #1161, and maybe others. Exported sites have their HTML minified, and this is by design.

@vndre
Copy link
Author

vndre commented Aug 29, 2020

I don't think you should leave any tag open, they weren't made so "by design". Although the hmlt specs says it is valid syntax it also informs about possible bugs because unclosed tags.

From the specs:
"A body element's end tag may be omitted if the body element is not immediately followed by a comment."

@ghost
Copy link

ghost commented Sep 2, 2020

@vndre If the html spec says it is valid, then it is valid. The whole point of minification is to reduce the file size to the bare minimum without breaking anything (i.e. staying spec-compliant).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants