You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...but this has no effect on the outputted dist/index.html file. After stepping through the buildPluginHtml function in vite's source it would appear that the HTML isn't being piped through any Rollup plugins which is why this doesn't work...but I could be wrong!
Atop of minifying the HTML with something like html-minify-terser it would be nice to have an option to inline the CSS in the head of the index.html file.
Perhaps you could add an stylesInlineLimit option similar to assetsInlineLimit with a sensible default like 5-10kb? So by default both the HTML would be minified AND the styles inlined in the head up to a certain threshold.
This would create one less network request and is an optimisation step that most frameworks out there like Nuxt, Gatsby etc. take to speed things up even more.
Thanks for the brilliant work on vite and your consideration 🎉
The text was updated successfully, but these errors were encountered:
...but the code that's passed into the transform function for the index.html file isn't the HTML but rather a string that looks like this: '\nimport "/src/main.js"' 🤔
Is your feature request related to a problem? Please describe.
Would be great if
vite
automatically minified the HTML of theindex.html
file at the root of the repo out of the box.I have attempted this with
rollup-plugin-html-minifier
androllupInputOptions.plugins
by doing:...but this has no effect on the outputted
dist/index.html
file. After stepping through thebuildPluginHtml
function in vite's source it would appear that the HTML isn't being piped through any Rollup plugins which is why this doesn't work...but I could be wrong!Atop of minifying the HTML with something like html-minify-terser it would be nice to have an option to inline the CSS in the
head
of theindex.html
file.Perhaps you could add an
stylesInlineLimit
option similar toassetsInlineLimit
with a sensible default like 5-10kb? So by default both the HTML would be minified AND the styles inlined in thehead
up to a certain threshold.This would create one less network request and is an optimisation step that most frameworks out there like Nuxt, Gatsby etc. take to speed things up even more.
Thanks for the brilliant work on
vite
and your consideration 🎉The text was updated successfully, but these errors were encountered: