Prerendering and caching css file


On my quest to improve the prerendering and the SEO I have realized an issue I am facing nowadays: Each time I update my app in prod a new css file is created with a new generated random name. My previous build and my previous css file are fully deleted. generates the proper HTML after prerendering but is keeping as a ref the css file from my build for styling, so as soon as I generate a new build, this ref is getting no css.

It means that if google crawls a page that was pretender a few days before I update my site it will have a ref to buildA.css which does not exist and therefor render a styleless page. Is there a way to keep the previous css file or have google crawler cache it so that this doesn’t happen after each update ?

Serve your code bundle from a CDN. I use cloudfront. If you need the code to do this, let me know.

1 Like

Sure I’d like to know more about this. I am hosted on clever-cloud where I also have my own CDN for the images but that’s not my strong suit to manage these.

The code is here, lives in the Server startup but I wouldn’t know how you configure this in your CDN. Scaling MeteorJS > 7,000 concurrent connections

In principle you make a call to your CDN to return the bundle. On the first request, the bundle is being cached. In your CDN you set a TTL let’s say to a month and cache all bundles for a month.