Using packages from npm

You can use any package on npm by just calling require(). It’s actually that simple. This will require the latest version of any package published to npm. This works from the embedded version of Tonic, too.

Requiring specific versions

If you want to require something other than the most recent version, just append @ to the end of the package name. For example, require("underscore@1.1.0").

###Searching for packages

You can also search for packages by clicking the search button in the top right corner of the window:

This will bring up a search interface, complete with links to the homepage of each package and the README if one is available.

Just click the require button (or double click a package from the list) and a require statement will be inserted into your notebook.

It appears that require("underscore@1.1.0") isn’t documented anywhere except this thread; I was searching for a while, to try and include a specific version of a package.

Just a thought!

1 Like

Yeah, we should be doing a better job of surfacing features like this right in the app. Thanks for the tip, we’ll give it some thought.

1 Like