How to Integrated the Typed.js JavaScript Library into a Rails Application

Feature thumb typed

It looks like the Typed Gem is deprecated, however this is such a small library we really don't need a gem for it. The steps for implementing the Typed.js library are as follows:

Copy the JavaScript code from the library

You can access the Github page and grab the raw JavaScript code here.

Once you have that, you can create a new file in the application, such as:

If you haven't already created a lib directory, you can do that by running:

Copy the raw JavaScript code from the Typed.js repo into the new typed.js file. And then call it from the application.js file, like this:

Now let's create some some coffeescript code file, we'll call it typed-implementation.coffee that will perform the 'typing':

And then call it right below the call to the typed.js library in the application.js file:

Now, all we have to do it add a new span tag that contains the element class that our Coffeescript code is looking for:

And you should now have a great looking 'typed' element on your site!