I really don't know how asset function works: where should I put the static files such as js and css and images and how asset function can determinate their location ? Thanks
1 Answer
In twig, the {{ asset() }} function search in your web directory. If you want to access to a file which is in web/images/mypic.jpg, use src="{{ asset('images/mypic.jpg')}}".
For JS and CSS, you can use the Resources/public directory of your bundle and use the stylesheet and javascript tag in your view
see =>
http://symfony.com/doc/current/cookbook/assetic/asset_management.html#including-javascript-files
1 Comment
Aysennoussi
Thanks a lot ! that what I was looking for , Asset looks in the Web directory!