When comparing Underscore Templates vs Nunjucks, the Slant community recommends Nunjucks for most people. In the question“What are the best JavaScript templating engines?” Nunjucks is ranked 5th while Underscore Templates is ranked 7th.
Ranked in these QuestionsQuestion Ranking
Pros
Pro For micro templating
Due to Underscore's optimized performance and ease-of-use it can be deemed as most fit for use in small sections of your code, where you just want a quick and simple template to render your content.
Pro Pre-compilation
Underscore allows you to compile your template once before data is inserted to it.
Pro Very user friendly
Pro Building blocks for CMS Websites
Another token based system with all of the logic, looping and variable control that other engines provide. But in addition it supports some more advanced page composition elements e.g. block inheritance, includes, layout inheritance, custom tags and macros — all absolutely perfect for a CMS where pages are typically composed of a series of “building blocks”.
Reference:
link
Pro Suppported by Mozilla
Pro Has Jinja2 as role model
Pro Open Source
Cons
Con Not a true templating engine
template
in underscore is simply a function which compiles a piece of template into HTML. It's useful for rendering HTML from JSON and it's not very useful when building complex frontend templates.