Skip to content

Load CSS and JS files with a cache-busting param (temp solution) - #31

Merged
brettimus merged 1 commit into
mainfrom
dynamically-load-css-and-js-with-cachebusting
Jun 19, 2023
Merged

brettimus merged 1 commit into
mainfrom
dynamically-load-css-and-js-with-cachebusting

Conversation

@brettimus

Copy link
Copy Markdown
Member

Might not be necessary given our setup, but I had this ready earlier in the week, figured I'd put it here for now

Comment thread files/explorer/index.html
link.rel = "stylesheet";
link.href =
AM_ASSETS_HOST +
"/static/css/index.3527160e.css" +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine for now, but we should end up in the situation where we do not require a "cachebuster". Since that defeats the purpose of the cdn. (I actually think that this might not even work atm, since we're not forwarding the querystring values to the s3 bucket).

I think the eventual goal is to have each version of the css/js include its own unique hash (what I assume is happening right now), and cache those file to infinity. Then have a fixed path that will redirect the client to the latest version. This file will not be cached as long, and will be invalidated on every deploy. am will then include this fixed version in the source.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep that's what i saw as the end goal as well — in which case for the final release we'll switch back to using content hashes for autometrics-explorer (right now the hash values are unchanging bc of the cloudflare setup)

@brettimus
brettimus merged commit 846a82d into main Jun 19, 2023
@brettimus brettimus changed the title WIP - Load CSS and JS files with a cache-busting param Load CSS and JS files with a cache-busting param (temp solution) Jun 19, 2023
@mellowagain
mellowagain deleted the dynamically-load-css-and-js-with-cachebusting branch July 24, 2023 14:19
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.

3 participants