Hacker News new | ask | show | jobs
by youngtaff 1547 days ago
The process in the article you link to for critical CSS doesn’t work in the real world as it becomes impossible to maintain

This script they use to load the async JS can also be racey and it’s far better to put the link to noncritical styles at the bottom of the page

1 comments

It is easy with a little automation :). In the build process, adding a step to calculate critical path css helps. This should probably be the last step and run on production post deploy. The calculated CSS is stored in redis which will be appended in the head for subsequent requests. This tool had inspired me to build this process at multiple orgs I have worked with https://github.com/pocketjoso/penthouse.

Agree on the async JS part but I guess browser makers will solve it soon.

Calculating the critical path in the build process doesn't scale in my experience - retailers with 10,000s products, publishers for 10,000 articles