GoogleChromeLabs / critters

🦔 A Webpack plugin to inline your critical CSS and lazy-load the rest.
https://npm.im/critters-webpack-plugin
Apache License 2.0
3.44k stars 108 forks source link

Feature Request: Caching CSS Based on Data-Attribute #169

Closed akshaymhk closed 1 month ago

akshaymhk commented 4 months ago

Implement a feature to cache CSS based on a data attribute (e.g., data-pagetype). This will optimize the process by caching critical CSS, thereby improving the Time to First Byte (TTFB).

Proposed Solution:

1. Enable Feature:

2. HTML Structure:

3. Unique Key:

4. Cache Implementation:

Benefits:

Example Usage:

<div class="page_layout_nxt" data-pagetype="homepage_loggedin_mobile"> <!-- Page content --> </div>

When cacheCriticalCSS is set to true, the critical CSS for this specific data-pagetype will be cached and reused for subsequent requests with the same unique key.

Pull Request:

https://github.com/GoogleChromeLabs/critters/pull/168

kara commented 1 month ago

Closing this issue because ownership of Critters has moved to the Nuxt team, who will be maintaining the project going forward. This repo is archived and won't receive any future updates.

If the issue is still relevant, please re-post it to the actively-maintained fork at https://github.com/danielroe/beasties.