Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2 Global/Site Wide Assets

I am using assetic to manage my assets in a Symfony2 application. I am wondering where I should be placing my global or site wide assets. Should they go in the /web folder or /app/Resources folder?

here is how I am currently doing things but I am not sure if this is best practice. I have searched high and low for recommendations.

{% stylesheets filter='less'
   '../app/Resources/public/less/test.less'
   '@MopaBootstrapBundle/Resources/bootstrap/less/bootstrap.less'
%}
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" />
{% endstylesheets %}
like image 226
Mike Avatar asked Jul 05 '12 21:07

Mike


1 Answers

Really, either is fine. And there's even a third option of having them all in a "Core" bundle. It depends on how you want to organize your project and if you intend to share your bundles.

I would slightly lean away from storing directly in /web. Only because I almost always combine and minify my assets so for this reason it's easier/cleaner to keep them all in a non-web-accessible location like /app/Resources or /src/CoreBundle/Resources and then let assetic:dump or assets:install push them to the proper web location.

like image 152
MDrollette Avatar answered Nov 01 '22 16:11

MDrollette