When comparing swig vs Closure Templates, the Slant community recommends swig for most people. In the question“What are the best JavaScript templating engines?” swig is ranked 14th while Closure Templates is ranked 19th. The most important reason people chose swig is:
Available for node.js and major web browsers
Ranked in these QuestionsQuestion Ranking
Pros
Pro Works both on the client and on the server
Available for node.js and major web browsers
Pro Does not hide HTML
Swig does not abstract HTML syntax from you (like e.g. Jade does) giving a certain filling of control over the markup.
Pro Language independent
The same template written in Closure would work both on Java as well as javascript.
Pro Well Tested and used by Gmail and Google Docs
Closure Templates being a project created by Google, is extensively used in some of the world's most famous and largest web apps which include Gmail and Google Docs. What this means for you is that you'll be using a Template engine that has not only been intensively tested but also that you'll be in good company, with lots of technical support.
Pro Secure
Closure has been designed keeping most security risks in mind. Templates created using Closure are auto-escaped automatically. Hence you won't have to worry about any XSS attacks.
Pro High Performance
Closure templates do not tend to slow down your site's performance or increase your page load time. They're compiled to extremely efficient JS code so that your page renders extremely fast, whether the templating is done on the client end or the server end.
Cons
Con No updates for at least 6 months
Swig has not received any new commits since June 25 2015.
Con Hard to find what you need in documentation
Docs are pretty, but hard to find exactly what you need. Although language has nice macros, you're going to hate them when they fail and you search for info for half an hour.
Con Strange errors from compiler
You won't get used to them even after a while.
Con Not widely used outside of Google
Closure Templates are mostly used in projects developed by Google and not in projects by third-parties. As such, it's unlikely for further versions to be released or for changes to be merged.