RythmEngine and TemplateClassManager the Biggest Objects of the heap : memory leak problems

We have as well faced and came across such issue but its because of compilation of templates again and again. To avoid this we did the below settings, Enable prod mode Enable template caching Set the template compiled directory location – to store the compiled version of template files. (Dont confuse with template directory configuration) … Read more

Jinja 2 safe keyword

The safe filter explicitly marks a string as “safe”, i.e., it should not be automatically-escaped if auto-escaping is enabled. The documentation on this filter is here. See the section on manual escaping to see which characters qualify for escaping.

Dealing with an empty list in mustache.js

After struggling for half a day with this problem, I’ve finally found an easy solution! Don’t check for the list, but check if its first item is not empty! Template: {{#persons.0}} <h2>Persons:</h2> <ul> {{#persons}} <li>{{name}}</li> {{/persons}} </ul> {{/persons.0}} {{^persons.0}}No persons{{/persons.0}} Data: { “persons”:[ {“name”: “max”}, {“name”: “tom”} ] } Output: <h2>Persons:</h2> <ul> <li>max</li> <li>tom</li> </ul> … Read more

Is it considered bad practice to use HTML in Jade?

Background Actually jade/pug syntax allows plain HTML (or any other plain text) through the use of 3 syntaxes, as you can see in the reference on the project’s site. dot syntax (also known as “Block in a Tag”) ul. <li><a href=”#book-a”>Book A</a></li> <li><a href=”#book-b”>Book B</a></li> pipe syntax (also known as “Piped Text”) ul | <li><a … Read more

Handlebars, loading external template files

The code is wrapped in an IIFE (Immediately Invoked Function Expression), which means the function is executed immediately. That’s what the following means: (function x() { console.log(‘hello’); })(); You can also do: (function() { console.log(‘hello’); }()); IIFEs are commonly used to create a “private” scope for a bit of code so that it plays nice … Read more