Symfony 4, include assets from the supplier catalog

I want to load the provider resources downloaded using the composer inside the supplier directory from my branch template.

Using a relative path is one solution (in this example I am going to enable bootstrap css, but the same problem for any other libs needed from the composer like jQuery, jQueryUI, etc.)

<link rel="stylesheet" href="{{ asset('../vendor/twbs/bootstrap/dist/css/bootstrap.min.css') }}" >

Symfony docs suggest using the: install asset to create a symbolic link from the vendor’s public directory, but I couldn’t understand how this works. assets: install -h is not so clear so that I can figure out how to associate a particular vendor path with a shared directory.

Create simlink with

ln -s /path/of/vendor/lib /path/public/dir

works fine, but the created symlinks will be deleted every time I look for an update with the composer.

Any idea of ​​"best practice" for listing assets from a supplier directory?

thank

+4
source share

Source: https://habr.com/ru/post/1692784/


All Articles