Skip to content

Commit

Permalink
Fix wrong path to composer.json for TwigExtension cs-fixer (#688)
Browse files Browse the repository at this point in the history
* Fix wrong path to composer.json for TwigExtension cs-fixer

* Fix extension call to match new library
  • Loading branch information
Drainpipe committed Sep 23, 2024
1 parent bdff738 commit 32f7477
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scaffold/.twig-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
$config->addTwigExtension(new TwigExtension($renderer, $urlGenerator, $themeManager, $dateFormatter, $fileUrlGenerator));

if (class_exists('\TwigStorybook\Twig\TwigExtension')) {
$composer_json = json_decode(file_get_contents(__DIR__ . '/../../../../composer.json'), true);
$composer_json = json_decode(file_get_contents(__DIR__ . '/composer.json'), true);
if (json_last_error()) {
throw new \RuntimeException('Could not parse composer.json');
}

$web_root = $composer_json['extra']['drupal-scaffold']['locations']['web-root'];
$config->addExtension(new \TwigStorybook\Twig\TwigExtension(new \TwigStorybook\Service\StoryCollector(), '/../../../../' . $web_root));
$config->addTwigExtension(new \TwigStorybook\Twig\TwigExtension(new \TwigStorybook\Service\StoryCollector(), __DIR__ . $web_root));
}

return $config;

0 comments on commit 32f7477

Please sign in to comment.