Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including metalsmith-npm with all npm packages installed. Try it out:

var metalsmithNpm = require("metalsmith-npm")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

metalsmith-npm v0.0.1

Metalsmith plugin to include npm modules in your globals.


Metalsmith plugin to include npm modules in your globals.


"metalsmith-npm": {
    <global variable to use>: <package name in npm to require()>

Example Javascript Usage

var npm = require('metalsmith-npm');

    _: "lodash",
    typogr: "typogr"

This is equivalent to:

    _: require("lodash"),
    typogr: require("typogr")

But is more concise and can be used with a CLI .json configuration, unlike the code above.

Example CLI Usage

"metalsmith-npm": {
    "_": "lodash",
    "typogr": "typogr"

Then in your other files you may use the globals, e.g. in archive.jade:

block content
    - var lineHeight = 2.2;
    - var archives = _.chain(articles).groupBy(function(item) {
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free