Thursday, 28 June 2018

Symfony 4, include assets from vendor directory

I would like to load vendor assets, downloaded with composer inside vendor directory, from my twig template.

Using a relative path is one solution (in this example I'm going to include bootstrap css, but the same problem is for any other libs required from composer, as jQuery, jQueryUI etc. )

<link rel="stylesheet" href="" >

Symfony docs suggest to use asset:install in order to generate a symlink from vendor directory to public, but I was unable to understand how it works. assets:install -h wasn't so clear to let me understand how to link a specific vendor path to the public directory.

Creating a simlink with

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

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

Any idea about "a best practice" to include assets from vendor directory?

Thank you



from Symfony 4, include assets from vendor directory

No comments:

Post a Comment