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-request with all npm packages installed. Try it out:

var metalsmithRequest = require("metalsmith-request")

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

metalsmith-request v3.0.0

Metalsmith plugin to grab content from the web and expose the results to metadata

Meatsmith Request

License version Build Status

Metalsmith plugin to grab content from the web and expose the results to metadata.

uses got under the hood to make HTTP calls.

Install

npm install metalsmith-request

API

Pass targets to the plugin with the use method:

const metalsmith = new Metalsmith(__dirname)
  .use(request({
    foo: 'http://domain.com/foo'
  }))

You can also pass options as the second argument to use with the got module

const metalsmith = new Metalsmith(__dirname)
  .use(request(
    {
      foo: 'http://domain.com/foo.json'
    },
    {
      json: true
    }
  ))

CLI

You can also use the plugin with the Metalsmith CLI by adding a key to your metalsmith.json file:

{
  "plugins": {
    "metalsmith-request": {
      "foo": "http://domain.com/foo.json"
    }
  }
}

Author: Ahmad Nassri • Github: @ahmadnassri • Twitter: @AhmadNassri

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