danielroe / danielroe/beasties

Feature Request: Expose method processCss which returns inlined css only

Open
#19 0 comments 5 reactions 0 assignees View on GitHub
enhancement good first issue
Dominant language
TypeScript
Stars
699
Forks
25
Avg merge
20h 13m
Merged PRs (30d)
35

Description

Use-case is to be able to use critters inside SSR, by processing only CSS and caching processed CSS - allowing the content to evolve independently from the processed CSS. Something like

let html = .... rendered html in ssr ...
const cacheKey = .... some logic ....
const criticalCSS = getInlinedCriticalCSSFromCache(cacheKey) ?? critters.processCss(html);

html = html.replace('', criticalCSS + '')
This will help also with https://github.com/GoogleChromeLabs/critters/issues/78

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.