Reputation: 49
I've put a css file in MyDirectoryBundle/Resources/public/css
.
I then linked to it using:
<link href="{{ asset('css/main.css') }}" type="text/css" rel="stylesheet" />
I checked if it worked
short test: body {color: #FF0000;}
Nothing changed.
The parent layout (layout.twig.html
) is in app/Resources/views
(3 level architecture).
I still don't understand why:
php console assets:install web/ --symlink
failsI am quite new to symfony2 (2 weeks practice only). I am working on Windows - just in case this may explain something...
Thank you very much for your help!
Upvotes: 0
Views: 118
Reputation: 41934
MyDirectoryBundle/Resources/public/css
, it'll be copied to web/bundles/mydirectory/css
. So you have to include it like: {{ asset('bundles/mydirectory/css/main.css') }}
.php console
, it seems like you're in the app/
directory when executing this command. In that case, app/web/
does not exists, so the error is completely valid.As a side tip, if MyDirectoryBundle
is your app bundle (a bundle tied to your app and not meant to be reused by other apps), I would recommend to put the CSS file in the web/
directory directly. There is no need to put it in the bundle in such a case (this is only related to bundles that are shared, so the CSS is shared as well).
Upvotes: 1