Question:
If you collect html
using python
, you can always {% extends "base.html" %}
template, and then connect separate html
– inserts to it through {% extends "base.html" %}
. There is something very similar in Java
with jsp
.
The question arises, is it possible to make a basic template without the participation of a backend server? I AngularJS
using AngularJS
+ Bootstrap 3
+ nginx
.
Answer:
the template engine that builds a template in python
(and in php) is called twig . It is very powerful and concise. In it, you can connect certain blocks, make your own extensions, inherit templates, template templates … In general, it is quite powerful.
In Angular, the template inheritance mechanism is different. There it is achieved through directives and nesting routes.
One of the examples of template inheritance in Angular.
It is also possible to insert other templates using include .
One example of creating directives
The mechanism of nesting routing can be read in this article.