Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle assets from the Symfony component #125

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Jean-Beru
Copy link
Contributor

Resolves #121

Allow using the asset twig function from the TwigBridge for public assets.


foreach ($this->inner->getFunctions() as $function) {
if ('asset' === $function->getName()) {
$function = new TwigFunction('asset', $this->getAsset(...), ['needs_context' => true]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this extension will decorate my entire app usage of "asset" ? ... well...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the PathPackage does not include the host, asset cannot work in a Gotenberg context.

How can we make it working without decorating it ? I was also thinking about the <base> tag to solve this problem but it's not recommended.

@smnandre
Copy link
Contributor

A custom asset package would not work here ?

@Jean-Beru
Copy link
Contributor Author

A custom asset package would not work here ?

If this package uses base_path, Gotenberg won't be able to find the file without the domain. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An exception has been thrown during the rendering of a template ("Warning: Undefined array key "_builder"").
2 participants