From 243b602cd2f15fabff5195cb829ae701fc82e3d8 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Mon, 26 Oct 2020 17:33:10 +0100 Subject: [PATCH] Do not include file location in the assets url --- src/KernelFactory.php | 2 +- src/Twig/AssetsExtension.php | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/KernelFactory.php b/src/KernelFactory.php index 8f72384..d6b36d8 100644 --- a/src/KernelFactory.php +++ b/src/KernelFactory.php @@ -53,7 +53,7 @@ static function (string $path) use ($parseSubPath): bool { } $twig = $configuration->getTemplateEngine(); - $twig->addExtension(new AssetsExtension($buildContext->getOutputDir())); + $twig->addExtension(new AssetsExtension()); return new DocsKernel( $configuration, diff --git a/src/Twig/AssetsExtension.php b/src/Twig/AssetsExtension.php index 0b4fed5..a45a972 100644 --- a/src/Twig/AssetsExtension.php +++ b/src/Twig/AssetsExtension.php @@ -14,14 +14,6 @@ class AssetsExtension extends AbstractExtension { - /** @var string */ - private $htmlOutputDir; - - public function __construct(string $htmlOutputDir) - { - $this->htmlOutputDir = $htmlOutputDir; - } - public function getFunctions(): array { return [ @@ -31,6 +23,6 @@ public function getFunctions(): array public function asset($path) { - return sprintf('%s/assets/%s', $this->htmlOutputDir, $path); + return sprintf('assets/%s', $path); } }