Hi @chrisMF, welcome.
This is a common question, and it’s often confusing what or why Sparkle does what it does.
So first, the biggest misconception is that the goal is to optimize publishing time. A website is (hopefully) extremely asymmetric in its usage pattern: it will be published far fewer times than it will be visited, so it makes sense that the primary goal is viewing performance and viewing correctness/consistency.
Publish performance is optimized in Sparkle, but only as a secondary goal, once viewing performance is attained.
So with that in mind, we spent many engineering hours figuring out how to make publishing fast, but even more figuring out how the published site would work with browser caches and server caches.
This is what we ended up with:
- there’s a single CSS file for all pages, because once it’s downloaded browsers will cache it for a while (or forever), for all pages of the site; the CSS filename has a timestamp so that a new publish will produce a newer fresh filename
- the timestamp in the filename (for CSS and javascript files) acts as a “cache buster”, or in other words it will cause browsers to re-download it when a new page is published; there are other ways to implement this but this is the most robust way to ensure no cache along the way will regurgitate an outdated version
- the HTML files reference the CSS and javascript filenames, and since those change, the HTML file changes as well
- image files (which are the bulk of a website upload), are only re-generated when they are changed in Sparkle (or more rarely when we make algorithmic changes to how they are generated)
- critically, when a file is unchanged in Sparkle it’s also not touched on disk
This setup has many wins:
- it plays well with differently configured servers, from the perfect
.htaccess
with expiry times for different file types, to the unconfigured deafult - it doesn’t retransfer the bulk of the files on each publish
- it plays well with browser caches, which will consistently reference a single version of your site, be it the latest, or an older cached version, all trickling down from the HTML file
- for when you export to disk, it plays well with file sync features of FTP apps
So ultimately yes, changing a single word in your project file is the worst case scenario, and will result in all of the text files in the site being transferred again, but then again this is small amount of data and a small price to pay.
Hope this helps.