Fixes
Re-hash content-hashed assets after optimization (#6)
optimize rewrote content-hashed assets (Vite/Rollup [hash], webpack [contenthash]) in place while keeping the original filename. With Cache-Control: immutable on those assets, a returning browser kept serving a stale cached copy after a redeploy - old cp-* rules against new cp-* references - silently breaking styling.
optimize now re-hashes every content-hashed asset it modifies: the file is renamed to a new content-hash filename and every reference to it (HTML, JS, CSS url(), and bundler manifests) is rewritten. Naming is deterministic, so identical input produces identical output.
- On by default. Only renames files whose names already look like content hashes; stable names like
styles.cssare left alone. - Pass
--no-rehashto keep the original filenames (for example, when running classpresso before the bundler applies its own hashing step). - New
rehashAssetsconfig option (defaulttrue).
Auto-exclude non-flattenable classes to prevent silent CSS loss
Classes that cannot be expressed as flat CSS properties - variant prefixes (md:, hover:, dark:), container queries (@sm, @[800px]), and combinator utilities (space-y-*, divide-x-*) - are now excluded automatically so patterns containing them are skipped instead of losing styles. Controlled by the new excludeNonFlattenableClasses config option (default true).
Notes
Why classpresso, not gzip: the win is at the render engine, not the wire. Every class on an element is another selector the browser matches during style recalculation. Collapsing a dozen utility classes per element into one cp-* class means fewer lookups and a smaller DOM. Gzip only collapses repeated bytes in transit, then the browser inflates them back to the same token count - so transfer-size deltas do not capture what the tool does.
Full changelog: v1.7.2...v1.7.3