You are doing everything right, except passing your bundle path to asset()
function.
According to documentation - in your example this should look like below:
{{ asset('bundles/webshome/css/main.css') }}
Tip: you also can call assets:install with --symlink
key, so it will create symlinks in web folder. This is extremely useful when you often apply js
or css
changes (in this way your changes, applied to src/YouBundle/Resources/public
will be immediately reflected in web
folder without need to call assets:install
again):
app/console assets:install web --symlink
Also, if you wish to add some assets in your child template, you could call parent()
method for the Twig block. In your case it would be like this:
{% block stylesheets %}
{{ parent() }}
<link href="{{ asset('bundles/webshome/css/main.css') }}" rel="stylesheet">
{% endblock %}