Release 2.57 (#5929)

This commit is contained in:
Kevin Papst
2026-05-21 22:14:10 +02:00
committed by GitHub
parent f0ce1c7bd6
commit 976d38e8a4
101 changed files with 4226 additions and 1119 deletions

View File

@@ -12,6 +12,7 @@ namespace App\Twig\Runtime;
use Psr\Container\ContainerInterface;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupInterface;
use Twig\Error\RuntimeError;
use Twig\Extension\RuntimeExtensionInterface;
final class EncoreExtension implements RuntimeExtensionInterface, ServiceSubscriberInterface
@@ -32,12 +33,19 @@ final class EncoreExtension implements RuntimeExtensionInterface, ServiceSubscri
public function getEncoreEntryCssSource(string $packageName): string
{
if (!\in_array($packageName, ['invoice', 'invoice-pdf', 'export-pdf'])) {
throw new RuntimeError('Unknown CSS package requested: ' . $packageName);
}
$lookup = $this->container->get(EntrypointLookupInterface::class);
$files = $lookup->getCssFiles($packageName);
$source = '';
foreach ($files as $file) {
if (!str_ends_with($file, '.css') || str_contains($file, '..')) {
continue;
}
$source .= file_get_contents($this->projectDirectory . '/public/' . $file);
}