Hi,

was just talking to people on IRC when I realized we have a great opportunity 
to reuse the way we make ESI available in twig templates to also support 
loading via javascript. this is a great way to be enable quick loading of the 
page and then loading slow and/or personalized content later while the user can 
already read the main content of the page.

this is how we define that a block can be loaded via ESI if a reverse proxy is 
available:
{{ render(..., ['standalone': true]) }}

but we could use the same API for javascript:
{{ render(..., ['async': true]) }}
{{ render(..., ['sync': true]) }}

Obviously everybody will have different taste in JS lib, so this would need to 
be a framework bundle template. Maybe we do not even ship a default one, dunno. 
Maybe all we should do is to make this extensible, so that one could define a 
service with a tag to trigger different logic based on the parameter set in the 
render call.

But I think it would be awesome to have this on core.
SonataPageBundle is however an example of how it can be implemented in userland:
https://github.com/sonata-project/SonataPageBundle/blob/master/Cache/JsCache.php

@Fabien: What do you think about this? Worth a PR?

regards,
Lukas Kahwe Smith
m...@pooteeweet.org



-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to