Is it possible to include an entire folder with the Twig included in Symfony2?
Basically, I’d like to be able to separate my Javascript objects into their own folder for increased readability, but then be able to include all of those back in to one file to present to the client.
Any ideas?
Thanks.
EDIT: I technically mean with Assetic, using the javascripts and stylesheets tags.
Do you mean to have the {% stylesheets %} and {% javascripts %} code in separate twig templates? Or just to have the js/css files in separate directories?
If you mean the latter, then that’s the standard use of Assetic. The example case in the docs describes exactly that.
http://symfony.com/doc/current/cookbook/assetic/asset_management.html
Note that while in the dev environment they will still be separated. In the prod environment they are combined. (This is configurable in app/config/config.yml)
If you are looking to have the {% stylesheets %} and {% javascripts %} tags in separate twig template but have them compile to a single JS/CSS file, this is not currently possible. But I believe they are working on this ability with the next major release.