1

I have an old javascript library with methods I need to use from within my spine app. How do I include it for use within spine?

2 Answers2

3

You need to include the library in your slug.json in the "libs" section like so:

{
  "dependencies": [
    "jqueryify",
    ...
  ],
  libs: [
    "path/to/old/javascript/file.js"
  ]
}

This will tell Hem to package files under "lib" first in your application.js. You should have access to the methods in your Spine classes. Make sure you include the extension (".js") on libs and path them relative to the root of your app. You can see the Hem docs for more info.

Joe Fiorini
  • 641
  • 5
  • 15
  • +1 this is the right way to do it. You can also use `require` in your setup.coffee. Not sure what the convention is for the two ways, but I would put external libs not available in npm in the slug.json/package.json, and your own random js files in setup. – Andrew Mao Sep 12 '12 at 19:40
1

Depends on your pipeline for assets and your platform. If just the old library to a page, use a script tag:

<script type="text/javascript" src="my_old_library.js"></script>

This is likely the same way you included spine.js on your page.

Dane O'Connor
  • 75,180
  • 37
  • 119
  • 173