Skip to content

Extract critical CSS automatically #791

Open

Description

@JuroOravec

Critical CSS is the CSS a page needs to draw what is visible before the reader scrolls. Putting it inline in <head> and loading the rest later makes the first paint faster.

From the django-components discussion: when a site is built from components, the framework knows which component CSS each page uses. So it could put the CSS of some components inline in <head> and load the rest as files later.

Existing tools such as critical and penthouse already extract critical CSS from a rendered page, including from local files, but they need Node. A possible extension: render each page, run one of these tools on the output, and put the critical CSS inline. A guide that shows how to do this by hand would be a smaller first step.

docs/design/extensions_roadmap.md sections 3 and 6 list critical-CSS extraction as not actionable yet. This issue keeps the request so it can be picked up when that changes. Inline CSS for whole components is tracked in #36.

Moved from django-components#1170.

Activity

  1. added
    enhancement
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions