magnars / stasis

Some Clojure functions for creating static websites.
348 stars 27 forks source link

Avoiding re-export of stale posts #14

Closed BorisKourt closed 5 years ago

BorisKourt commented 9 years ago

As per the wonderful building static sites with stasis post I am running a (stasis/empty-directory! export-dir) before each export.

As the project grows building everything from scratch takes greater and greater amounts of time (especially when factoring in image optimization with many images at various sizes)

Do you have any advice on checking for stale, already output and unmodified since that time, content? I can think of a basic static EDN file that holds export timestamps for each post, against which I check when I run 'export'. I am unsure if this is a good way to proceed though?

Any advice would be greatly appreciated.

magnars commented 9 years ago

Hmm, I'm not convinced you'll get the performance you want from this strategy. I'm guessing that your assets are handled separately from the pages? So even if you can track all the data sources for a page, and determine if it needs to be exported again, you'll still be handling all the assets on the side.

As for the images, optimus-img-transform already caches its work on the file system. You can pass in a :tmp-dir option to change where the cached images are placed.

It would be interesting to find out what is making your exports slow.