When comparing Riot vs Aurelia, the Slant community recommends Aurelia for most people. In the question“What are the best JavaScript libraries for building a UI?” Aurelia is ranked 2nd while Riot is ranked 5th. The most important reason people chose Aurelia is:
Full support for Typescript built in
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 Out of the box Typescript support
Full support for Typescript built in
Pro Good binding system
Clear, intuitive and HTML/SVG compliant binding syntax.
Examples:
Default binding => value.bind
One Way binding => value.one-way
Two Way binding => value.two-way
One Time binding => value.one-time
Pro Conventions over configurations
Configured to give you the most common use cases by convention, which means you only need to change the default configuration for edge cases. This means that for normal cases far less boiler plate code has to be written.
Pro Out of the box ES6 support
Aurelia includes native support for ES6 and even comes with a Gulpfile which helps with transpiling ES6 code to ES5.
Pro Allows developers to build their application however they want
Aurelia is extremely unopinionated and was designed to be highly modular. This gives the developer the freedom to develop their application however they want, without forcing them in paradigms or rules predefined by the framework. Likewise, any of the individual components can be swapped out if so desired.
Pro Standards compliant
Aurelia developers always try to keep within existing and emerging Web Standards, making it easier for developers to follow best practices in web development.
Pro Agnostic code
Most of the code you write is Aurelia-agnostic. It's one of the closest libraries that you'll find to basically write plain-old, vanilla Javascript or TypeScript code (classes) and doesn't polluate your HTML/SCSS. That way you can easily test it, switch to another implementation and make it look clean (business oriented). Even the HTML.
Pro Easy to learn
Learning aurelia basically means learning EcmaScript and HTML, since aurelia is designed for standards compliance. Also, aurelia embraces upcoming ES language features by convention, such as ES class decorators for dependency injection, encouraging clean architecture and future-proof code.
Pro Variable binding helps with self-documenting the code
The syntax used to bind variables within the application class is very similar to Javascript itself. You can specify the type of the binding you are using explicitly, which practically self-documents your code and makes it easy to understand whether a value is one-way or two-way binded.
Pro Structure
Aurelia.js consists of modules that can be used as a full framework or separately.
Pro Great documentation
One of the most crucial pieces of any new technology or framework is the documentation. At present even though Aurelia is pre-beta, the documentation is pretty complete. There are code examples missing and whatnot, but for the most part it is concise and makes the main parts of the application easy to understand.
Pro Full commercial support
Aurelia is officially backed by Durandal Inc. and has commercial and enterprise support is available.
Pro Data binding choices with sane defaults
Aurelia defaults to one-way data binding, alining with conventional wisdom. However, there are times when two-way data binding proves useful, such as binding an input widget with a view-model. Aurelia makes two-way data binding available to developers and uses it by convention when appropriate.
Pro Plays well with other frameworks
Aurelia can be used alongside of React and Polymer, since it is designed for interoperability. In practice, this means Aurelia developers can use React components by including an Aurelia custom element:
https://github.com/Vheissu/aurelia-react-example/blob/master/README.md
It also works well with Polymer, since they are both based on the WebComponents standards:
http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/integrating-with-polymer
Pro Powerful helper CLI available
https://github.com/aurelia/cli
The CLI helps rapid creation of projects with generators, building, deploying and hot reloads. Webpack should be coming soon.
Pro Growing community
The Aurelia community is growing at a great pace. Still doesn’t rival the big players line Angular or React, but the answer to an Aurelia issue is a quick question away on their Discourse.
Pro Provides dependency injection
With dependency injection, you can load in extra javascript and new functionality just when you need it.
This is particularly helpful with testing as you can swap out services for test services.
It also means in single page apps you can load dependencies only as you need them instead of loading them up all up at the start.
Cons
Con No big success stories yet
There are no notable big web products build with aurelia yet
Con Needs more support from the community
It would be great to have a lot of plugins made by the community, or video tutorials from experiences when using it. Hopefully in the near term future.
Con Two-way data binding is often considered an anti-pattern
Two-way data-binding means that a HTML element in the view and an Angular model are binded, and when one of them is changed so is the other. One-way data-binding for example does not change the model when the HTML element is changed.
This is a rather controversial subject and many developers consider two-way data binding an anti-pattern and something that is useless in complex applications because it's very easy to create complex situations by using it and being unable to debug them easily or understand what's happening by just looking at the code.