FMElfinderBundle icon indicating copy to clipboard operation
FMElfinderBundle copied to clipboard

Install assets to vendor directory instead of to public directory

Open jontjs opened this issue 1 year ago • 2 comments

Describe the bug Any time you run Symfony's assets:install command, the public/bundles/fmelfinder directory is removed, so you then have to run elfinder:install to (re)install the assets. One workaround is to add elfinder:install to composer.json's auto-scripts section but it has to be AFTER assets:install.

This differs from (for example) friendsofsymfony/ckeditor-bundle which needs to have its ckeditor:install command run BEFORE assets:install. This is because its command puts the assets into vendor/friendsofsymfony/ckeditor-bundle/src/Resources/public, and assets:install then copies them to public/bundles/fosckeditor.

To Reproduce Install this bundle, following all its instructions. Then at a later date run composer install. The public assets will no longer be present, so the finder fails with a javascript error Script error for "elfinder".

Additional context I think the "Symfony standard" way for bundles to handle assets is the way friendsofsymfony/ckeditor-bundle does it, i.e. download the assets into vendor/ so that assets:install will copy (or symlink, according to the user's preference) them into public/bundles/. I've not managed to find any official guidance on this, but it is what Symfony's command does.

Note that changing this would, to my mind, constitute a breaking change because any workarounds people have made for the current behaviour may no longer work as expected.

jontjs avatar Jan 03 '24 10:01 jontjs

actually good point @jontjs, probably worth to change behavior, and mark next version as major, with such changes

helios-ag avatar Jan 04 '24 05:01 helios-ag

I'll try to get a PR ready for it.

jontjs avatar Jan 04 '24 07:01 jontjs