diff --git a/docs/leaf/getting-started.md b/docs/leaf/getting-started.md index b494fc89c..7013d190b 100644 --- a/docs/leaf/getting-started.md +++ b/docs/leaf/getting-started.md @@ -41,11 +41,22 @@ app.views.use(.leaf) This tells Vapor to use the `LeafRenderer` when you call `req.view` in your code. -!!! note - Leaf has an internal cache for rendering pages. When the `Application`'s environment is set to `.development`, this cache is disabled, so that changes to templates take effect immediately. In `.production` and all other environments, the cache is enabled by default; any changes made to templates will not take effect until the application is restarted. - !!! warning For Leaf to be able to find the templates when running from Xcode, you must set the [custom working directory](../getting-started/xcode.md#custom-working-directory) for you Xcode workspace. + +### Cache for Rendering Pages + +Leaf has an internal cache for rendering pages. When the `Application`'s environment is set to `.development`, this cache is disabled, so that changes to templates take effect immediately. In `.production` and all other environments, the cache is enabled by default. Any changes made to templates will not take effect until the application is restarted. + +To disable Leaf's cache do the following: + +```swift +app.leaf.cache.isEnabled = false +``` + +!!! warning + While disabling cache is helpful for debugging, it's not recommended for production environments as it can significantly impact performance due to the need to recompile templates on every request. + ## Folder Structure Once you have configured Leaf, you will need to ensure you have a `Views` folder to store your `.leaf` files in. By default, Leaf expects the views folder to be a `./Resources/Views` relative to your project's root.