16 Nov 2013

Install vtt.js with Bower

Built distributions of vtt.js are now available on Bower. To install it you can either do:

  bower install vtt.js

Or you can list it as a dependency in your bower.json file like so:

  {
    "dependencies": {
      "vtt.js": "~0.3.0"
    }
  }

If you don't want to use Bower and would rather build your own vtt.js you can clone the repo and do:

  git submodule update --init --recursive && grunt build

For more info you can check out the vtt.js README.

Hosting Prebuilt vtt.js Distributions

I encountered a problem getting vtt.js onto Bower; which was that Bower needs a git endpoint for your package that has the final version of your package in it. For JavaScript projects you would usually just point it at your GitHub repo and be done. However, we have a build step to get a version of vtt.js that is runnable in all browsers. This version contains polyfills for a lot of things that an old browser might not have, like VTTCue, VTTRegion and TextDecoder. Therefore, we can't just put the GitHub repo as an endpoint because then when you install the package you would still need to do another build step, which isn't ideal. What I've done instead is created a vttj.s distribution repo which we can point Bower at and get a working copy of vtt.js right off the bat.

This isn't the most ideal solution and there are probably better ones out there so if you know of one give me a shout!

- Tagged in mozilla, seneca college, open-source, and cdot.

comments powered by Disqus

Wow coding Copyleft Richard Eyre 2013

Code for this site can be found on GitHub.