Replies: 2 comments 3 replies
-
Hi @elibroftw Lithium does not provide a C++ template engine but there is definitely some templating libraries you can use with lithium. You can check this stackoverflow thread for candidates: |
Beta Was this translation helpful? Give feedback.
-
I've been researching the same topic and FWIW found another SO question: https://stackoverflow.com/questions/355650/c-html-template-framework-templatizing-library-html-generator-library . I even tried Inja since it seemed the most promising (at least it has the most GH stars of What I find surprising is that younger languages like Go and Rust have more HTML/text "template engines" than C++. Go has its own standard library implementation of templating, but there are competing libraries. And Rust has at least two "type-safe" engines that compile the templates directly into object code. Perhaps it's that in C++ "template" means generics/STL (even in SO questions people wonder what does the poster really want). Someone took this to the extreme: https://github.com/csb6/html-plus-plus. Anyway, I'll be taking a look at Jinja2Cpp and perhaps some others. One other possibility is using std::format (in C++20) or fmt::format which does provide type-safe and even positional arguments (i.e., for i18n). |
Beta Was this translation helpful? Give feedback.
-
In flask, I have templates that flask templates with jinja2. I use the templating feature extensively in my web apps to avoid redundant code like the navigation bar and .
Does lithium have something similar?
If not is there any c++ library that's maintained that comes with this feature I'm looking for?
Beta Was this translation helpful? Give feedback.
All reactions