When comparing Riot vs Polymer, the Slant community recommends Polymer for most people. In the question“What are the best JavaScript libraries for building a UI?” Polymer is ranked 4th while Riot is ranked 5th. The most important reason people chose Polymer is:
It provides a base component.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Minimal DOM operations
Riot takes the expressions from a DOM tree and stores them in an array. Each of these expressions points to a DOM node. On each cycle these expressions are compared to the values in the DOM. So when a value has changed, Riot automatically updates the corresponding node. This way the operations are kept to a minimal amount and since the expressions can be cached, going through 1000 of them takes less than 1ms.
Pro Lightweight
Riot is made to be used with websites of any kind, so it's built to be easy and lightweight, but still maintaining all the needed features for a UI library. It's only 2.5 KB in size when minified. So it can also be used for mobile web apps without requiring much bandwidth to download.
Pro Components use familiar HTML tags
Riot components use custom tags which are nothing more than familiar HTML tags coupled with JavaScript. This eliminates the need to learn another templating language or syntax. For example:
<todo>
<h3>TODO</h3>
<ul>
<li each={ item, i in items }>{ item }</li>
</ul>
<form onsubmit={ handleSubmit }>
<input>
<button>Add #{ items.length + 1 }</button>
</form>
this.items = []
handleSubmit(e) {
var input = e.target[0]
this.items.push(input.value)
input.value = ''
}
</todo>
Riot tries to separate HTML and JavaScript, while still keeping them inside the component. This way, the HTML can also be neatly mixed with JavaScript expressions.
Pro Supports server side rendering
Riot has support for server side rendering. The views and data are rendered on the server, then those views are sent as HTML to the browser when a user requests them.
This helps with initial loading time and is very useful for SEO purposes because the web app is indexed by search engines same as other static websites that have their HTML on the server.
Pro Easily pluggable with JS/HTML/CSS preprocessors
It is very easy to use your favorite preprocessors with the Riot compiler. Riot comes with CoffeeScript, ES6 (Babel), TypeScript, LiveScript and Jade support. You can also add your own parsers.
Pro Very simple
It makes React look confusing as hell. Nothing against React - It's just that easy to implement!
Pro Scoped CSS available in components
Riot supports scoped CSS inside components for every browser by rewriting stylesheet rules.
Pro Lives well with any other library, framework and usage pattern
Since it's not opinionated, even the scripting can be in anything that can be transpired to JavaScript.
Pro Separation of concerns with RiotControl
RiotControl is inspired by Facebook's Flux Architecture Pattern and it's a simple Central Event Controller/Dispatcher for Riot. It's extremely lightweight (like Riot itself) but unfortunately passes up on some features in favor of performance and simplicity.
RiotControl helps with storing the stater of the application, by passing events from views to stores and vice-versa. Stores can communicate with many views and views can do the same with many stores, this enables to clearly separate concerns and inter-component communication.
Pro Various basic components
It provides a base component.
Pro HTML markup is not string
HTML markup as it can be a non-string.
Pro Flex layout components
It provides Flex layout components.
Pro CSS is easy to apply
CSS can be applied far more comfortably than React.
Pro No need for special debugging tools
The presence od specialized debugging tools are advertised by competitors. The all features of web components are natively supported by browser embedded development tools.
Pro Excellent routing
The router is embedded into CLI for project creation and covers as web as Progressive web app, also fused with Polymer layouts out of the box. The shop template for CLI has a complete solution including the routing.
Pro Complete web app stack support
Full app stack from data tier to routing, progressive web app, responsive layouts makes no need to seek outside of Polymer ecosystem for application features.
In addition to waste set of mature web components in Polymer Elements along with Vaadin Elements there are thousands of web components in the wild comparable to jQuery plugins set.
Pro Excellent documentation
Polymer guides you as with tools (cli, build environment, app templates,..) as with complimentary documentation on all phases of app development from creation of app as progresive web app to production deployment instructions.
As Polymer is standards based, the whole community around those standards also helping in documentation and support.
Pro Based on web components
Web Components are a collection of specifications released by W3C as a way to reduce the complexity of web apps by creating reusable components. Browser support is currently poor for web components, however Polymer is developed to make web components compatible with modern browsers.
Pro API is easy to understand, based on standard
The Polymer APIs are split on application layers and follow standards on all possible ways: Web Components, CSS variables, async API via Promises and so on.
Cons
Con No server-side rendering
Polymer does not support server-side rendering. This results in higher loading times, more HTTP requests and it's not very SEO friendly, since search engines have no way of indexing a page if it's not rendered in the server.