This repository was archived by the owner on Oct 22, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -232,19 +232,20 @@ This script is only an example and must be adapted to your individual environmen
232232File: ` bin/parse-twig.php `
233233
234234``` php
235- <?php
235+ use Odan\Twig\TwigCompiler;
236+ use Slim\App;
237+ use Twig\Environment as Twig;
236238
237- require_once __DIR__ . '/../vendor/autoload.php';
239+ /** @var App $app */
240+ $app = require __DIR__ . '/../config/bootstrap.php';
238241
239- // Specify our Twig templates location
240- $loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../templates');
242+ $settings = $app->getContainer()->get('settings')['twig'];
243+ $templatePath = (string)$settings['path'];
244+ $cachePath = (string)$settings['cache_path'];
241245
242- // Instantiate Twig
243- $twig = new \Twig\Environment($loader);
246+ $twig = $app->getContainer()->get(Twig::class);
244247
245- // Compile all Twig templates into the cache directory
246- $cachePath = __DIR__ . '/../tmp/twig-cache';
247- $compiler = new \Odan\Twig\TwigCompiler($twig, $cachePath);
248+ $compiler = new TwigCompiler($twig, $cachePath);
248249$compiler->compile();
249250
250251echo "Done\n";
You can’t perform that action at this time.
0 commit comments