When comparing Knockout vs pug (Jade), the Slant community recommends pug (Jade) for most people. In the question“What are the best client side templating libraries?” pug (Jade) is ranked 1st while Knockout is ranked 5th. The most important reason people chose pug (Jade) is:
Ranked in these QuestionsQuestion Ranking
Pro Easy data binding
Pro Easy to learn
Has a low entry barrier and an easy learning curve. It's especially easy to learn for beginners.
Pro Built in templating
Bindings in Knockout can also be used to control the generated structure of the HTML. There are bindings provided to allow for iteration and conditionals. The structure of the html reflects the structure of the data so iterative elements are bound to arrays in the data model. Having the HTML structure maintained by bindings keeps the templating simple, easy to read, and maintain.
Knockout also allows for string based templating so you can use whatever templating library you prefer.
Pro Legacy browser support
Supports a large number of browsers, including IE6.
Pro Great documentation
The excellent tutorials with built-in exercises are a great learning experience, even for people without prior MVVM and data binding experience.
Pro Lightweight and plays nicely with other libraries
Pro Dynamic models help with keeping the code simple and clean
Models in Knockout can be watched to keep the page data up to date by using observable objects. The observables notify Knockout when data is changed and automatically updates the page when this happens. By having Knockout maintain this relation, it keeps the front end code cleaner and simpler, and by enforcing a consistent pattern with observables the methodology can be more robust.
Pro Very flexible
One can do a lot of things and it keeps self references and other types of loops under control.
Pro It's only a library
Knockout does one thing, and does it well. It doesn't try to take on more than one area. It does MVVM data binding and that is it.
Pro Simple manageable modules
Using components is a great way of breaking up large modules into simpler ones.
Pro Clean syntax
Pro Identation reflects nesting
With Jade you can quickly overview the hierarchy of a template.
Pro Easy to read, powerful mixins
Jade supports mixins. These not only make your templating job easier but are also super-easy to read.
Pro Easy sublayouts using block and extends
By using the extends and block keywords, sublayouts can be made with intuitive syntax.
Pro Preprocessor support
Filters make it easy to embed compiled languages such as coffeescript or markdown directly into the template. A filter will allow you to keep your inline code and content consistent with the rest of your codebase so you can continue using your prefered language with your outputted HTML.
Pro Reuse code in other languages
Pro Interactive documentation
There's an interactive documentation available here that allows you to play around with code examples and watch the results in real time.
Pro High performance on the server and client side
Apart from their functionality all template engines need to be efficient in terms of the time they require to render a page. Jade beats most of its competitors in this area, it is highly optimized to deliver good performance on both the server and client ends.
Pro Use Markdown for readable markup
Jade is awesome at templating structural markup, but that's not all Jade is awesome at. It also allows you to use markdown within your template itself which will render to a beautiful HTML page.
Con Slower than others when amount of objects grows
Knockout has a bad performance when the dealing with large amount of objects. You can see more here.
Con Can become complex once the application grows large
Knockout leaves the application structure to the developer and it can become quite complex and unmanageable in the hands of a beginner once the application grows large and complex.
Con Two way binding requires a little extra work
When allowing users to edit existing data, the two-way binding of observables means you'll need to have to save original values before they're edited, to make comparisons or revert if the user cancels the action.
Con Cannot copy/paste examples from the internet
Examples from CSS frameworks like Bootstrap are never utilizing the Pug syntax, which means that you cannot ever copy/paste something to quickly see how it would look or if it works. You would have to convert the HTML to Pug first.
Con Unforgiving in case of indentation errors
The structure is entirely determined by the indentation. That means that indentation errors will ruin the end result, often without an easy way to find the error. Indentation errors are easily introduced by copy-pasting, by rearranging code and by working in a team where not everyone uses the same indentation style. (E.g tabs vs. spaces.)
Con off-side rule templating language not working well with native HTML
plain HTML pages usually can contain very deeply nested structures, whether they are hand-written by web UI designers or generated from popular web design tools or taken from existing HTML templates, which are a nightmare for front-end engineers to convert into Pug templates, where you have to take care of handling the indentation rules and the deeply nested HTML elements, even creating multiple blocks that don't have any meaning in terms of business logic, just to house the HTML elements within bearable amounts of indentations.
Pug templates are nice for Python programmers who don't want to learn HTML to start writing web pages and develop some entire websites personally from the ground up, but for any serious project that involves more than half a dozen people and has separate positions of web UI designers, front-end developers, and back-end engineers, it's much better to choose something more closely compatible with native HTML as the template engine. Pug is simply too alien from native HTML and resembles a lot more like those other off-side rule languages like Python.
Con Bad performance
Bad sintaxe (Short-hand HTML) and bad performance. No streaming or asynchronous calls. https://github.com/mauricionobrega/nodejs-template-benchmark