When comparing Marko vs Ember, the Slant community recommends Ember for most people. In the question“What are the best client-side JavaScript MV* frameworks?” Ember is ranked 16th while Marko is ranked 17th. The most important reason people chose Ember is:
Ember already defines the general application structure and organization for you. This was done to prevent developers from making mistakes which would needlessly over-complicate their application. While it's still possible to go out of these practices forced to developers by the Ember authors, you still have to go out of your way to force them.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Extremely fast
Marko consistently outperforms other alternatives in code benchmarks, both on rendering speed and compilation time.
Pro Custom tags
Custom tags provide a simple mechanism for embedding more complex components into a template by extending the HTML grammar with support for new tags. For example:
<div>
<say-hello name="World"/>
</div>
Custom tags are easy to create since they just map to a JavaScript "renderer" function as shown below:
module.exports = function sayHelloRenderer(input, out) {
out.write('Hello ' + input.name + '!');
}
Custom tags support nested content:
<fancy-overlay title="My Title">
This will be the body content of the overlay
</fancy-overlay>
Custom tags can also have parent/child relationships to support more complex use cases such a "tabs" component with nested "tab" components:
<fancy-tabs>
<fancy-tabs:tab label="Home">
Content for Home
</fancy-tabs:tab>
<fancy-tabs:tab label="Profile">
Content for Profile
</fancy-tabs:tab>
<fancy-tabs:tab label="Messages">
Content for Messages
</fancy-tabs:tab>
</fancy-tabs>
Pro Streaming
Streaming allows progressive HTML rendering and reduces time to first byte.
Pro Server-side rendering
Marko supports both server-side and client-side rendering.
Pro Marko Widgets
Marko Widgets allows UI components (rendering + behavior) to be built using Marko.
Pro Compiled templates are readable CommonJS modules
Avoids ugly globals and "named" templates.
var template = require('./template.marko');
var html = template.renderSync({name: 'Frank'});
Pro Asynchronous rendering
Marko makes additional asynchronous calls after the view rendering has begun.
Pro Lightweight runtime (~4 KB gzip)
Pro Easy to integrate with express.js
Easy Integration with Express and Node
Pro Documentation is well maintained and helpful
The documentation is extensive and very helpful. It also contains several sample applications which are very useful.
Pro Allows JavaScript expressions
JavaScript expressions can be executed inside the templates.
Pro Simple and readable syntax
Marko has a HTML-like syntax which should be easy to read and understand for everyone who has even minimal experience in web development.
Pro Short learning curve
It is easy to get up to speed and understand what is going on in a very short period of time.
Pro Small compiled templates
Marko's compiled templates are usually very small, as proven by benchmarks.
Pro Lots of tests
To prevent regressions, Marko includes a full suite of tests. The testing harness renders a collection of templates and does an exact string comparison to make sure that the tests rendered exactly as expected. There are also API tests, and negative tests to make sure that errors are reported in a friendly way.
To run tests:
git clone https://github.com/marko-js/marko
cd marko
npm install
npm test
Pro Friendly compile-time error messages
Error messages come in an easy to read and friendly format, with valid stack traces and file formats of the file(s) which brought the error(s).
Pro Concise and Mixed syntax
The Concise syntax type lets you write Marko with a Jade-like indentation based syntax, and the Mixed mode lets you combine in regular HTML-style syntax.
Pro Server and client logic can easily be expressed within the same template
Pro Has a very active and interactive community
Marko's development community is rather small compared to other frameworks but community is well mannered and active. You can chat with the core development team using gitter.im
Pro Opinionated in terms of application structure
Ember already defines the general application structure and organization for you. This was done to prevent developers from making mistakes which would needlessly over-complicate their application. While it's still possible to go out of these practices forced to developers by the Ember authors, you still have to go out of your way to force them.
Pro Ember-CLI
Ember-CLI is a very useful tool. With just a couple of commands it scaffolds the code, installs dependencies and finally compiles everything itself. It's very useful to quickstart an Ember project.
Pro Uses Handlebars
Ember's preferred templating language is Handlebars. This is mainly because Handlebars is a logic-less templating language and Ember tries to keep it's logic outside the view.
Another reason why Ember benefits from Handlebars is mostly aesthetic as Handlebar's clean syntax makes for easier to read and understand templates.
Finally, Handlebars templates are compiled instead of interpreted, which means that they are much faster to load.
Pro Convention over configuration
Ember follows the philosophy of "convention over configuration" meaning that it already has almost everything configured for you, so you just have to start coding and developing your project right away.
Pro Complete front-end stack
Ember is practically a complete full-stack front-end framework. It comes with it's own asset pipeline, router, services etc...
Pro Completely community based
Pro One of the fastest template rendering engines (new glimmer)
Pro Easy to understand documentation
The Ember Guides are well structured and very well written. The API documentation is also fantastic.
Pro Ember's Object model makes the framework extremely consistent
Most of Ember's components come from the Ember Object Model. It's the basis for views, controllers, models and even the framework itself. This means that the framework is extremely consistent since almost every component shares the same core functionalities and properties since they are all derived from the same object.
Pro Excellent routing
Route handlers for the URLs can see a wide range of possible application states, asynchronous logic in the router makes sure of Promises. And implementing makes sense.
Pro The run loop
It batches bindings and DOM updates to increase performance; if similar tasks are added to a batch, the browser would only need to process them in one single go, as compared to re-computing for each task one at a time.
Pro Excellent API
Ember's API are really easy to understand and work with. It has methods which allow you to harness complicated functionalities in an easy to understand way.
Pro New router has less boilerplate code
Ember's new router need much less boilerplate code that it previously did.
Pro Debugging tool for almost every web browser
Ember also has a debugging tool called Ember Inspector which is used for debugging the client side of your app.
Pro Works great with jQuery
You can use any of jQuery’s features.
Pro Useful bindings
EmberJS provides with an extremely handy feature of advanced bindings. With this you can not only set the path to the binding value in your app but also set in which direction you want the changes to propagate to (oneway
, single
, multiple
etc).
Pro Promises everywhere
Promises represent an eventual state in asynchronous logic. Having promises everywhere (almost) means you could write simple and modular code, using almost any API that Ember provides.
Pro Computed properties
Having custom properties in your templates is itself a huge plus but having custom computed properties is an even greater benefit, since now you can code your custom function as a property and call it from your template. Hence rendering your page exactly according to your needs.
Pro Built-in router
Ember comes with built-in routing capabilities. There's no need to install third-party plugins to be able to use routes.
Pro Auto-updating templates
If you've used handlebars (Ember.js's templating is powered by HandleBars) helper tags in your code (like {{#each}}
) you won't have to worry about updating your template each time you add/remove data from your page, Handlebars will auto update your template for you.
Cons
Con If you want to get the full experience you have to use NodeJS
To use markojs's most popular feature: SSR although you can use any language based server as a backend. It is rather complicated.
Con Very opinionated and not customizable enough
Some custom use cases are not possible. For example, trying to build an AMP page using Marko can be very challenging (special style tag requirements are hard to work with, also, Marko by default inserts a script tag into the rendered output html which is invalid in AMP and needs to be manually removed, etc..)
Con Large library size
At 69Kb gzipped, it is one of the largest JavaScript frameworks. This means Ember might be an overkill to use on simpler projects.
Con Very opinionated
Ember (and many extensions, like Ember Data) force the implementation down specific architectural paths. These paths are what Ember believes is best practice and typically are fine, but not in all cases. This can occasionally lead to fighting with your framework which is never productive.