metalsmith-request

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

Usage no npm install needed!

<script type="module">
  import metalsmithRequest from 'https://cdn.skypack.dev/metalsmith-request';
</script>

README

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