As a pattern library template language Nunjucks leaves a lot to be desired.
The key point of a pattern library is to include some sub-template that by default renders a component or element but allow for flexibility of overriding content, settings, behaviour.
Issues I've found with Nunjucks in this:
macro syntax is very restrictive, only arguments passed in can be used in render
calling a macro allows only one inner block of templating
include syntax allows including a subtemplate but not overriding any blocks that template defines
Jinjas with syntax is missing, meaning includes can't even get local scoped variables
Twigs embed syntax stuck for over a year now and would solve this if merged.
Suggest that we should fork nunjucks and merge the embed syntax, plus fix some other things like jinjas with syntax.
As a pattern library template language Nunjucks leaves a lot to be desired.
The key point of a pattern library is to include some sub-template that by default renders a component or element but allow for flexibility of overriding content, settings, behaviour.
Issues I've found with Nunjucks in this:
macro
syntax is very restrictive, only arguments passed in can be used in rendercall
ing a macro allows only one inner block of templatinginclude
syntax allows including a subtemplate but not overriding any blocks that template defineswith
syntax is missing, meaning includes can't even get local scoped variablesTwigs
embed
syntax stuck for over a year now and would solve this if merged.Suggest that we should fork nunjucks and merge the embed syntax, plus fix some other things like jinjas
with
syntax.