Skip to content

[AssetMapper] Incorrect code example #19311

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

Closed
PhilETaylor opened this issue Dec 18, 2023 · 3 comments · Fixed by #19312
Closed

[AssetMapper] Incorrect code example #19311

PhilETaylor opened this issue Dec 18, 2023 · 3 comments · Fixed by #19312
Labels
AssetMapper hasPR A Pull Request has already been submitted for this issue.

Comments

@PhilETaylor
Copy link
Contributor

On this page https://symfony.com/doc/6.4/frontend/asset_mapper.html#page-specific-css-javascript

This block

ScreenShot-2023-12-18-23 31 46

causes this error

ScreenShot-2023-12-18-23 32 47

Because the entrypoints should be passed as an array, The correct code should be

{{ importmap(['app', 'checkout']) }}

@OskarStark
Copy link
Contributor

cc @smnandre @weaverryan

@smnandre
Copy link
Member

That is 100% true

@xabbuh xabbuh added the hasPR A Pull Request has already been submitted for this issue. label Dec 19, 2023
OskarStark added a commit that referenced this issue Dec 19, 2023
…rypoints (smnandre)

This PR was merged into the 6.4 branch.

Discussion
----------

[AssetMapper] Fix importmap code example with multiple entrypoints

Fix #19311

importmap twig extension method does indeed require an array or a string, and not a variadic : https://github.com/symfony/symfony/blob/6.4/src/Symfony/Bridge/Twig/Extension/ImportMapRuntime.php

Commits
-------

ebca2e9 Update asset_mapper.rst
@PhilETaylor
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AssetMapper hasPR A Pull Request has already been submitted for this issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants