4 ms·
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 https://www.npmjs.com/p
by jordwalke 7y 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 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.
- flatroze 7y agoThanks, I'll look into making it work with pipes or some other way to interact with headless browsers.
- ahub 7y agoReach out when you do so, I've a similar use case here !
- gildas 7y agoYou want this: https://github.com/gildas-lormeau/SingleFile/tree/master/cli https://github.com/gildas-lormeau/SingleFile/tree/master/cli.