Plan to implement {{block.super}}
See original GitHub issueHello, thanks for your hard works! currently I’m using nunjucks in our frontend project(mock server with express), but I have a plan to migrate to liquidjs instead, because our Backend is also using liquid, some of their syntax differencies bother me a lot because each time I have to manually adjust nunjucks templates to standard liquid syntax before sending them to backend developers, I have searched a lot and finally found liquidjs, really amazing, but I really miss the {{block.super}}
syntax, since we have already supported “block”, I would like to know do we have some plan to implement it as well? It would be a huge benefit and I think some others might also have the same question as me 😃
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
The potential of implementing superblocks for multifunctional ...
The Barcelona superblock has been proposed as a sustainable urban neighbourhood transformation strategy in cities.
Read more >what is the purpose of {{block.super}} in django template?
Can anybody tell me what is block super in the case of django template language? ... So lets create a block in example.html...
Read more >Blocks, Superblocks and the Making of Cities
Superblocks were part of the modern architecture movement, but they were even more an attempt to marry city planning with the automobile.
Read more >What are Super Blocks - The Design Response
“ The plan is based around the idea of superilles (superblocks) – mini neighbourhoods around which traffic will flow, and in which spaces...
Read more >Barcelona's superblocks are a new model for “post-car” urban ...
If the plan can survive politics, it can demonstrate how to create tight-knit urban communities.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @harttle! 👋 I was hunting around to see if this feature had already been mentioned and ended up here.
I do wonder if this is something that may be reconsidered (AFAICT it still does not exist in Ruby Liquid). However, I do think the value of having something like
{{ block.super }}
may have been a little muddled back in 2017.As it exists in Django,
{{ block.super }}
is a way to tap into the contents of a block as it exists in a parent layout without overriding it, but it does not attempt to mix the parent or child scopes. As explained here in Django docs (emphasis mine):(This also exists in the Jinja2-inspired Nunjucks as the
{{ super() }}
function.)What I’ve commonly used this to do is append or prepend markup that has been defined in a parent layout’s block without overriding it. A good example of this with CSS linking:
Parent layout: base.html
Child page: index.html
Output
What’s nice about this is you can define some defaults or base values in a block that the inheriting template can choose to overwrite or add to as needed. As provided in the two scenarios I am familiar with (Django and Nunjucks) there is never the intention that the parent and child pages’ scopes combine or interact in any way — either the as-rendered contents of the parent page’s block is rendered as-is where
{{ block.super }}
was called, or it’s overwritten by the contents of the child page’s contents of the block.I believe this is can be very helpful for defining blocks in a parent layout with smart defaults that a child page can augment instead of completely overwrite (or as it often happens, content that appeared in the parent’s block gets copy-pasted to the child page’s block because it needed the exact same content + an extra line on the end).
Now supported on @9.20.0, thank you guys.