top | item 20775071

(no title)

jordwalke | 6 years ago

I really like this concept, and I've been using an npm package called inliner which does this too: https://www.npmjs.com/package/inliner

I'm glad there's more people taking a look at the use case, and I'd be interested to see a list of similar solutions.

If you combine this with Chrome's headless mode, you can prerender many pages that use JavaScript to perform the initial render, and then once you're done send it to one of these tools that inlines all the resources as data URLs.

  /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome ./site/index.md.html --headless --dump-dom --virtual-time-budget=400
The result is that you get pages that load very fast and are a single HTML file with all resources embedded. Allowing the page to prerender before inlining will also allow you to more easily strip all the JavaScript in many cases for pages that aren't highly interactive once rendered.

discuss

order

flatroze|6 years ago

Thanks, I'll look into making it work with pipes or some other way to interact with headless browsers.

ahub|6 years ago

Reach out when you do so, I've a similar use case here !