3

jinja templates make me look towards html in a whole new light. are we 'inserting' data to an already rendered page? am i really mixing server code with ui ? It doesn't feel so. there are if else and loops being executed for html code, like wtf?

I don't know but everything feels so good. like i was literally hating every piece of website i was writing in php. everytime i wrote <div>....</div> followed by <?php ... ?> followed by another html tag /php tag in a fuckin php file, i wanted to kill someone from w3c.
WHY THE FUCK ARE WE ALLOWING THE MIXUP ?WHY IS PHP FILE HOLDING HTM TAGS? WHY?WHY?WHY?

But this... this is beauty. their is separation of concerns. jinja has some big powers, we can loop, repeat, make clauses, inherit other html classes, load html content into blocks, set variables,
but main concepts like file handling, response/request handling,calculations,etc are all being done in separate python files. I know that these jinja templates also might be running python in background, but atleast a developer cannot fuck up that code.
we can be sure that if correct jinja codes are written in html, then it would load correctly. And wherever devs doesn't fuck up, the output is better to understand and more maintainable/scaleable

Comments
  • 1
    I love jinja. Use it with Flask daily. I too also hate the clusterfuck that PHP can be if done incorrectly.
  • 2
    A template engine should be mandatory now adays....

    It requires some restrain (do not pour business code in templates), but it's the only sensible approach.
  • 0
    This is the first time that I visit here. I found so many exciting matters in this particular blog, One thing I would like to request you that pls keep posting such type of informative blog.
Add Comment