Components inside .html files o just .jinja files? #9
-
How can implement a .jinja component inside a .html file to render it from render_template . ( Yes , I am using flask) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Either if you call For example, this code: catalog.render("Product", __file_ext="html") will search for a Alternatively, you can change the default extension (for all components) when creating the Catalog, with the catalog = Catalog(file_ext="html")
catalog.add_folder("myapp/components") |
Beta Was this translation helpful? Give feedback.
Either if you call
catalog.render(component_name)
from inside a template or from your python code, it's possible to tell JinjaX to search for file with a different extension using the__file_ext
argument (begins with two underscores).For example, this code:
will search for a
Product.html
file (or for the first file with a name beginning with 'Product' and ending in '.html') in your components folder(s), instead of the defaultProduct.jinja
.Alternatively, you can change the default extension (for all components) when creating the Catalog, with the
file_ext
argument: