mheap/Silex-Extensions

Assetics + Twig

lyrixx opened this issue · 15 comments

What does exactly not work?
Any errors?

I do not want to load all my asset from the config.
So when I use, in a twig template, {% javascripts ... %} It does not add an asset collection to the asset manager.

Please see here : lyrixx/Silex-Kitchen-Edition@32b4fbc#L8L49

I'll have a look. Do you have jabber/gtalk?

Yes, i sent you a message.

Thx

any updates about this issue? It will be great to use assetic in twig templates for silex

cj commented

Any updates on this?

unfortunately not.

i've been working with the Fate/Assetic extension too.. referencing the Kitchen-Edition setup.. that code doesn't seem to be working quite right..The asset files get created and saved.. but once you make modifications the asset arrays.. it seems to get buggy.

Maybe I'll have to rewrite it.

I found the big reason I was having problems was because I wasn't paying attention to the assetic ['debug'] behavior. It was caching the the scripts.js so of course it wasn't updating like I wanted.. However, I'm still finding that when I add additional j-scripts like jquery-extensions, the created script doesn't behave like I expect it too and I have a to keep it separate. It seems like even in the example on Kitchen-Edition -- jquery is left out.. not sure why that was done.

Jquery is left out because many websites do the same thing. So it's pretty sure that jquery will already be in client browser cache. ;)

So, the problem still exist?

I've looked through Symfony and borrowed some bits to get Assetic and Twig to play nice together in Silex apps. Let me know what you think (the code probably needs to be cleaned a bit).

digitaltoad/silex-extensions@2dba9cb

I've updated my code a bit to fix a few debug issues and pull in a bit more of the caching code provided in the AsseticBundle.

As far as I know, Silex + Twig + Assetic are playing together nicely now (if you use dumper->addAssets()).