Skip to content

How do I customize the example for my npm package?

Packages on npm are automatically given a special section on, like this page for canvas:

By default, the page shows a simple example, e.g.:


But, as you can see in the Canvas example above, you can customize this example. To do so, just add an entry to your package.json. 

"tonicExample": "var _ = require('underscore');"

You can also put the example in a separate file, if you prefer, and then add this property instead:

"tonicExampleFilename": "example.js"

If you want to read more about the npm/tonic integration, check out this blog post

Feedback and Knowledge Base