Implements cache for tailwind output

Created on 19 November 2024, 6 days ago

Problem/Motivation

Tailwind JIT works nicely with Internal Cache Page module. But when there're dynamic query parameters in the request, the internal cache will consider it as a new request, hence trigger the tailwind compiler. However, page content might still be the same with different query params, e.g ?utm=tracking_source, so unnecessary recompilation bring high pressures to the server.

Proposed resolution

1. Extract the css classes from the content
2. Sort the css classes with alphabet
3. Generate a cache key with classes hash
4. Cache tailwind's output, so next time when the same set of classes are requested, return the cache result immediately

It can also benefit authenticated visitors, since it can work without internal page cache.

Works to be done

Right now only element classes are extracted. Classes in javascript or json string are not handled.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇨🇳China stjuan627

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024