Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimizing Performance by Caching Critical CSS #168

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

akshaymhk
Copy link

@akshaymhk akshaymhk commented Jul 2, 2024

Caching CSS Based on a Data-Attribute (e.g., data-pagetype)

To enable this feature, first pass a key in the options: cacheCriticalCSS: true.

Next, add a class named page_layout_nxt to any <div> in the HTML and provide a data attribute (e.g., data-pagetype). This data attribute can be any unique key based on a combination of page name, user logged in status, and device type (mobile/desktop).

Critical CSS is then saved in the cache and returned from the cache instead of being recalculated for the same unique key. This will improve the Time to First Byte (TTFB).

Related Issue:

This pull request closes #169

Signed-off-by: Akshay Mishra <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Caching CSS Based on Data-Attribute
1 participant