One of the components of our project Shopium.ua
is the administrative interface, which is built as a fully running rich internet application client.
You quickly get used to good things, and we quickly got used to the Jinja2 template syntax we use to generate HTML on the server side. And they wanted the same,
but with pearl buttons
And formed such requirements to him:
- Django / jinja-like syntax
- compiling a template into JS code (as in Closure Templates)
- HTML auto shielding
- simplicity (development, use, implementation)
After searching the Internet and not finding anything like it, we exclaimed "Yes, developers or not, after all!", And wrote our own.
Template engine consists of a single executable file. The algorithm is very simple:
- Using pyparsing, parse the template source code and build the syntax tree.
The output is a .js file with the template code.
The resulting file can then be connected to your project.
The source code for the project under the MIT license is available in my BitBucket repository
. There is also a brief example of using a template engine
At the moment, all the code is very
experimental, and it was written literally in one day. In our plans to bring it to a stable state and use it everywhere.