Minify prerendered HTML (and app.html?)
See original GitHub issuesapper export
minifies the generated HTML. Perhaps we should do the same thing here?
// svelte.config.cjs
module.exports = {
kit: {
prerender: {
minify: true
}
}
};
// svelte.config.cjs
module.exports = {
kit: {
prerender: {
minify: {
// manually specify options (https://www.npmjs.com/package/html-minifier)
collapseBooleanAttributes: true
// ...
}
}
}
};
We could potentially do the same thing for src/app.html
, though the benefits are less pronounced.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:17
- Comments:8 (8 by maintainers)
Top Results From Across the Web
minifyHtml Plugin - Scully.io
This postRenderer plugin for Scully will minify the HTML of your prerendered pages. Removing unnecessary code will decrease the size of your files....
Read more >Html-minifier NPM - npm.io
html -minifier v4.0.0 · HTMLMinifier · Minification comparison · Options Quick Reference · Special cases · Installation Instructions · Usage · Running benchmarks....
Read more >Pre-rendering Angular Applications - Blog - Brecht Billiet
Learn how to use Server-side rendering to prerender our Angular ... the HTML even more, we could use an HTML minifier like this...
Read more >Prerendering Explained - Netlify
Web crawlers are also trained to read HTML, but not trained to read JavaScript Single Page app as something more than just one...
Read more >Isomorphic Support | Enact
The app's initial state is rendered via React into an HTML string and embedded statically into the index.html file. Why Prerender? Having the...
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
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
Being able to control the minification options (or disabling it entirely) sounds good, as this is one of the requested Sapper features that we deferred on because of a lack of a sane way to handle configuration.
I have mixed feelings about whether this should be enabled by default for prerendered sites. It’s probably a good idea, but then it’s also been the subject of a whole lot of invalid Sapper bugs.
I agree that it’s probably only a good idea to include this on HTML that can be minified during build time and not at runtime.
I’d like it if it was a bit more turnkey but it does seem very difficult to offer sensible defaults. Without configuration it won’t do a whole lot for you. So it probably doesn’t make sense to weigh the package down with a dependency that won’t do very much for most people.