If you build html using python , you can always make a template, and then connect to it separate html inserts through {% extends "base.html" %} . Something very similar is in Java with jsp .

The question arises whether it is possible to make a basic template without the participation of the server backend? I use AngularJS + Bootstrap 3 + nginx .

  • Little is not clear the essence of the issue. In my understanding, in any case, you should make forms on the frontend (I use vue) and transfer data from the backend (using laravel) to the form or simply get data on the backend from the frontend (in my situation through Request) ... Answer to your question , if I understood everything correctly, yes, it is possible and even necessary in principle - Oleg Shleif
  • Sure you may. Angular, like any MVC framework, provides the means for templating. Read the documentation. - hindmost
  • Perhaps this will help solve the problem taoofcode.net/… - Anton Globa

1 answer 1

A 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 Angula, the pattern inheritance mechanism is different. There it is achieved through directives, and nesting routes.

One example of pattern inheritance in angular.

It is also possible to insert other templates using include .

One example of creating directives

The routing nesting mechanism can be read in this article.

  • Still need to be reminded that in the same place, uh, live components that are collected in small, uh, flocks and mate creating great, uh, compositions. - user220409
  • "Yes, and in php", your outlook on a single template? - Oleg Shleif
  • @OlmerDale what have the components to the first angular? This mechanism was expanded later, mostly for migration to the second angular - Kostiantyn Okhotnyk
  • @OlegShleif no, still used smarty. Just twig is more flexible and convenient. - Kostiantyn Okhotnyk
  • @OlegShleif I concluded that this is twig by its syntax. And twig, unlike smarty, is used in python - Kostiantyn Okhotnyk