Symfony2 Global/Site Wide Assets
Asked Answered
J

1

6

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 %}
Jemappes answered 5/7, 2012 at 21:29 Comment(1)
You might also want to take a look at stackoverflow.com/questions/10830129Quantity
C
1

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.

Concerned answered 5/7, 2012 at 21:56 Comment(1)
The documentation seems to push you strongly in that direction: symfony.com/doc/current/book/…Polychrome

© 2022 - 2024 — McMap. All rights reserved.