mockra

EmberJS Gravatar Component - 17 Aug 2014


Adding Gravatar support to an ember application is pretty straightforward, but you will need to include a library that provides MD5 hashing support. The library we’re going to use in this example is JavaScript-MD5. This example also assumes you’re using ember-cli.

You’ll first want to install the MD5 library with the following command:

bower install --save JavaScript-MD5

You can then include the library by adding the following line to Brocfile.js.

app.import('bower_components/JavaScript-MD5/js/md5.js');

Now that we’ve installed our library for generating an MD5 hash, we can create our component. We’ll want to generate the component using the command line tools.

ember generate component gravatar-image

We can then update the generated component files to include the required code:

You can then include a Gravatar image on your website with the following line: