Skip to content

Using AssetMapper to manage web assets of bundles #53912

Open
@javiereguiluz

Description

@javiereguiluz

AssetMapper is great and upgrading web apps to AssetMapper is also great and not too complex.

But, managing bundle's web assets with AssetMapper is not possible at the moment.

To make it work, we'd need, at least, two things:

(1) A way to run importmap commands when developing the bundle locally. Maybe include a small binary with the component like we do in other components?

(2) A way to reference to bundle's assets in {{ importmap('...') }} Twig function. Maybe allow to use the typical bundle logic path such as importmap('@AcmeBundle/app') ?

But before doing anything, we must decide if want to support AssetMapper in bundles.

I looked at the most starred GitHub repos that include the symfony-bundle tag and this is what I found:

Bundle Has Web Assets?
doctrine/DoctrineBundle
doctrine/DoctrineMigrationsBundle
EasyCorp/EasyAdminBundle
sensiolabs/SensioFrameworkExtraBundle (bundle is archived)
FriendsOfSymfony/FOSUserBundle
symfony/monolog-bundle
FriendsOfSymfony/FOSRestBundle
doctrine/DoctrineCacheBundle (bundle is archived)
nelmio/alice
lexik/LexikJWTAuthenticationBundle
doctrine/DoctrineFixturesBundle
hwi/HWIOAuthBundle
nelmio/NelmioApiDocBundle
sonata-project/SonataAdminBundle
stof/StofDoctrineExtensionsBundle
nelmio/NelmioCorsBundle
dustin10/VichUploaderBundle
KnpLabs/KnpPaginatorBundle
liip/LiipImagineBundle

So, not many popular third-party bundles need this feature.

But, there are others that could use it:

  • Apps like Sylius which internally are made out of bundles and many of them inclde web assets
  • Private apps that also use bundles internally to split their logic

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions