Support for HTML minification for prerendered pages #3150
Unanswered
enri90
asked this question in
Discussion
Replies: 1 comment
-
|
I'm inclined to think a Vike extension would be best here. Alternatively: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
When using Vike with prerendering, the generated HTML files contain indentation and whitespace (pretty-printed HTML). While this is fine for readability, it results in larger HTML payloads than necessary for production.
Currently, it seems that Vike does not provide a built-in option to minify the prerendered HTML output (e.g. collapsing whitespace, removing comments, etc.).
Example of the current output:
Expected production output could look like:
My questions are:
1. Is there currently a recommended way in Vike to minify HTML for prerendered pages?
2. Is there an official hook or configuration intended for this purpose?
3. Would it make sense to add a built-in htmlMinify option for prerendered output?
At the moment the only workaround seems to be using a custom hook and a library such as html-minifier-terser, but I wanted to check if there is a more idiomatic Vike approach.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions