Creating and working with add-ons

Ember has a common way of sharing code using something called Ember Addons (also known as add-ons). Ember Addons make it easy to distribute reusable libraries with other applications. Anyone can create add-ons. You can publish them to NPM or to your own private Git repository.

Keep in mind that you can also use Bower to install frontend dependencies. This is done through the Bower package manager. Take a look at Chapter 1, Ember CLI Basics for more information on how to do this.

In this recipe, we'll take our chat program from the last section and make it an add-on.

How to do it...

  1. Create a new add-on called sockjs-chat. Generate these files:
    $ ember addon sockjs-chat
    $ cd sockjs-chat
    $ ember g component sockjs-chat ...

Get Ember.js Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.