metalsmith / layouts

A metalsmith plugin for layouts
MIT License
116 stars 49 forks source link

Template caching should be off by default #104

Closed lostfictions closed 7 years ago

lostfictions commented 8 years ago

Hey there. I just lost a bunch of time today trying to debug why changes in my Nunjucks templates weren't being reflected in the Metalsmith output in a build-and-watch-for-changes scenario, and it turns out that it was because Nunjucks is one of the Consolidate-supported libraries that supports caching.

This doesn't seem like a sensible default for a static-generation scenario. (And I'm surely not the first one to have been bitten by it!) Template caching in Nunjucks and other engines is a feature designed for server-side scenarios where there might be significant network load and where rendering bottlenecks are a real concern. By contrast, the performance benefits of having it enabled for something like Metalsmith are probably imperceptible for the average use case. I think caching for this plugin should be strictly opt-in, and ideally better-documented as well (eg. it should be supported as a proper option rather than as a param that gets tossed over to Consolidate if metalsmith-layouts doesn't recognize it as one of its own.)

doodzik commented 8 years ago

Thank you for your submission. I think you made a good case to have it off by default. Would you mind opening a pull request with the necessary changes?

doodzik commented 7 years ago

Closing due to inactivity This can be still reopened