Skip to content

Components inside .html files o just .jinja files? #9

Answered by jpsca
v4ld3rr4m4 asked this question in Q&A
Discussion options

You must be logged in to vote

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:

catalog.render("Product", __file_ext="html")

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 default Product.jinja.

Alternatively, you can change the default extension (for all components) when creating the Catalog, with the file_ext argument:

catalog = Catalog(file_ext="html")
catalog.add_folder("myapp/components")

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jpsca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants