Compile time include postprocessor
pragmasoft-ua opened this issue · 0 comments
I'm thinking about the concept of the compile time include support. Basically, many interactions between templates make sense to do at the compile time.
Possible use cases may be inlining of svg or css or including prelude/coda fragments, even including the result of evaluation of templates.
To avoid extending the grammar, I thought about utilizing ValueExpression, like
@inline("fragment.rocker.html")
The problem is that the current TemplateModel does not support access to models of the entire processed view collection. This may be needed to avoid re-processing of the template which has been already processed, when statically included in the another template. This probably can be implemented as part of the postprocessor state though.
Another problem is that postprocessor needs an access to the JavaGenerator instance (to obtain RockerConfiguration from it for example). Simple solution would be to either pass it as an additional parameter to the process method, or use ThreadLocal and static accessor in JavaGenerator itself like
static JavaGenerator current();
Please consider extending the postprocessor api, as described above.