Open hgl opened 5 years ago
Jup, just came here after encountering the same unwished behaviour. I hope this can get addressed soon...
I don't think it's svelte issue. You can add an express midleware to minfy your html. Or if you use export there is external tools to do so. Is there any case where it's not enought?
@Mojeer0 Adding express middleware means that Express has to modify the source in memory, the source itself will not be changed from what I've heard. I know the few newlines aren't a huge drama, but I'm a perfectionist and it just seems off when I've minified everything else over rollup, but the production output of sapper contains unminified html. I'd appreciate some official guidance on how to achieve this.
+1
There's actually a helper method to minify html already: https://github.com/sveltejs/sapper/blob/f3e9fc48d281ff990458a4a537a50d59db105e37/src/api/utils/minify_html.ts#L3
There's actually a helper method to minify html already:
This appears to be used to minify the template.html file on build... I don't see any obvious way to use it to minify SSR output, unless I'm mistaken?
I'm not saying there's an easy way to use that method as an end user today, but that an implementation of this feature could utilize that method
We might want to open an issue at svelte-preprocess instead. It can already transform svelte component html (it supports pug for example), so we could ask the maintainer to maybe add an option to minify it as well.
Describe the bug
npm run build
__sapper__/build/server/server.js
create_ssr_component(($$result
Information about your Sapper Installation:
Additional context I was looking at the source code of returned html in browser (
npm run start
, not dev version), and found the html were mostly unminified.