summaryrefslogtreecommitdiff
path: root/src/Renderer
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-10-28 12:59:49 +0100
committermsquare <msquare@notrademark.de>2018-11-24 16:30:36 +0100
commitf845a5ab8b67e1d0b11779f1754bcc3f2193d67b (patch)
treee4893832772d468873b047a443461175be774c88 /src/Renderer
parent944c29b96429ec95ac1371cb33cc43704a60c7b1 (diff)
Added caching for templating and routing
See #486 (Implement caching)
Diffstat (limited to 'src/Renderer')
-rw-r--r--src/Renderer/TwigServiceProvider.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/Renderer/TwigServiceProvider.php b/src/Renderer/TwigServiceProvider.php
index 57ebe9e5..d7b6bd09 100644
--- a/src/Renderer/TwigServiceProvider.php
+++ b/src/Renderer/TwigServiceProvider.php
@@ -62,7 +62,21 @@ class TwigServiceProvider extends ServiceProvider
$this->app->instance(TwigLoaderInterface::class, $twigLoader);
$this->app->instance('twig.loader', $twigLoader);
- $twig = $this->app->make(Twig::class);
+ $cache = $this->app->get('path.cache.views');
+ if ($config->get('environment') == 'development') {
+ $cache = false;
+ }
+
+ $twig = $this->app->make(
+ Twig::class,
+ [
+ 'options' => [
+ 'cache' => $cache,
+ 'auto_reload' => true,
+ 'strict_variables' => ($config->get('environment') == 'development'),
+ ],
+ ]
+ );
$this->app->instance(Twig::class, $twig);
$this->app->instance('twig.environment', $twig);