Closed iamandrewluca closed 2 years ago
vite-plugin-singlefile
was designed for SPAs, where there's a single index.html
file.
I'd recommend experimenting with a custom รฎles
module that uses critters
to inline the stylesheets using the ssg.beforePageRender
hook.
You could use this logic as a starting point.
@ElMassimo ๐คฃ 2 lines of code Carl, 2 lines. It worked from the first try ๐ Thanks!
Glad that it worked, thanks for sharing! ๐
I think it would be useful to write a blog post about creating modules for รฎles.
I gave up on writing blog posts, it takes a lot of time. But here is a video ๐
Haha, great! But to clarify, I was thinking out loud, I should write that post and add it to the docs ๐
Is your feature request related to a problem? Please describe. Google Lighthouse reports direct loaded CSS as a blocking asset on most websites.
Describe the solution you'd like Google Lighthouse recommends to inline critical CSS in HTML
Describe alternatives you've considered Tried to use
vite-plugin-singlefile
plugin for Vite, but it throws an erroriles.config.ts
The Error
Additional context https://github.com/vitejs/vite/issues/621 https://github.com/richardtallent/vite-plugin-singlefile