Where to put assets like CSS and Javascript in Symfony

I just solved a fairly simple problem, but for my own record and if it could possibly save someone some time, here you go.

In Symfony, you want to put your assets (CSS, Javascript, images) in the right location, which is src/BUNDLE_NAME/Resources/public.

To use your assets in your web application, run this command.

php app/console assets:install --symlink

This command creates a symbolic link with the bundle name in your web/bundles directory and voila, the assets are now available via the Twig/Symfony asset command.

New to Symfony? Check out my getting started tutorial here.

Share Button