Skip to content

Conversation

@CamSoper
Copy link
Contributor

@CamSoper CamSoper commented Oct 15, 2025

Summary

Adds a comment to theme/tailwind.config.js to force CSS regeneration, which busts the CloudFront cache that was serving stale CSS for the reinvent page.

Problem

The reinvent page (https://www.pulumi.com/reinvent) was not displaying correctly in production because the CSS class -translate-y-1/2 was missing from the served CSS file.

Root cause: The build process fingerprints CSS before PurgeCSS runs, causing CloudFront to cache CSS with a filename that doesn't match the actual content. When the reinvent template was added, PurgeCSS output changed (to include the new class), but the filename hash stayed the same because the source CSS didn't change.

CloudFront was serving a 20+ hour old cached version of bundle.34a92c....css that was generated before the reinvent template existed.

Solution

This PR adds a comment and unused class to tailwind.config.js to force Webpack to regenerate the CSS with new content. This causes Hugo to compute a new fingerprint hash, resulting in a new filename that CloudFront has never cached.

When this deploys:

  • New filename: bundle.<NEW_HASH>.css
  • CloudFront cache miss → fetches fresh CSS
  • Reinvent page displays correctly ✓

Long-Term Fix

This is a temporary workaround. The proper architectural fix is tracked in #16274, which proposes:

  • Computing CSS fingerprints after PurgeCSS runs, or
  • Adding CloudFront cache invalidation to the deployment process

Testing

  • Local build generates new CSS filename
  • Local reinvent page displays correctly
  • Production deployment will generate new CSS hash
  • CloudFront will serve fresh CSS (within 5 minutes of deployment)

Files Changed

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

@claude

This comment was marked as resolved.

@pulumi-bot
Copy link
Collaborator

The current build process fingerprints CSS before PurgeCSS runs,
causing the filename hash to not match the actual served content.
When HTML templates change (like the reinvent page) but CSS source
doesn't, PurgeCSS output changes while the filename stays the same.

This causes CloudFront to serve stale CSS cached for up to 1 year.

This commit adds a comment to tailwind.config.js to force Webpack
to regenerate the CSS with new content, which causes Hugo to compute
a new fingerprint hash. The new filename will not be in CloudFront's
cache, forcing fresh content to be served.

This is a temporary workaround. See #16274 for the proper long-term
architectural fix.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@CamSoper CamSoper force-pushed the CamSoper/cloudfront-css-invalidation branch from 7982a40 to 254b3ab Compare October 15, 2025 20:36
@CamSoper CamSoper requested a review from jkodroff October 15, 2025 20:41
@CamSoper CamSoper enabled auto-merge (squash) October 15, 2025 20:44
@pulumi-bot
Copy link
Collaborator

@CamSoper CamSoper merged commit 6f25e16 into master Oct 15, 2025
10 checks passed
@CamSoper CamSoper deleted the CamSoper/cloudfront-css-invalidation branch October 15, 2025 20:47
@CamSoper CamSoper mentioned this pull request Dec 1, 2025
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.

4 participants