Morgan Conrad plugins

Metalsmith plugins

Metalsmith is a pluggable file processor, built on NodeJS, generally used for creating static web sites.

**Note:** After a five year hiatus, as of 2022 [Metalsmith is back under active development and maintenance](
The Metalsmith documentation is sparse, so I ended up writing a couple of plugins for debugging: **assert** and **inspect**. In developing them, it inspired two others: **cp-r** and **keymaster**.

All these modules are open-source, in JavaScript, available on NPM and GitHub, and use Tape for unit tests. CI is performed by Travis CI and test coverage compiled by Coveralls.


Test file objects with Node's assert module. For example, to test that all have a property named "title":

    "title exists" : { actual: "title"}
} ) )


Copies a folder recursively, typically to copy web assets (CSS, scripts, images) from the working directory into the metalsmith destination directory. e.g.:

   from: "_directory/pathto/assets",
   to: "_destination/pathto/assets"
} ) )


Inspects the file objects, typically via Node's util.inspect(). To see everything:



A relatively simple but powerful plugin to create new values and store them under new keys. Since that's what most plugins do, this could be considered as a "meta-plugin" for developing plugins.

For example, to add the filename as metadata under the "foo" key:

.use(keymaster({from: function(data, filePath) {
                   return filePath;
                to: 'foo'}));


Reads content from Contentful, places into metalsmith "files" for processing (e.g. by Markdown)

To grab all "projects", use their field "slug" as a filename, and put them under the path "/projects/{slug}.md"

   client: {
      space: '<space_id>',
      accessToken: '<access_token>'
   query : {
      content_type: 'project'
   msFiles : {
      idField: 'slug',
      filename: "projects/${id}.md"
} ) )
Uses JavaScript nodejs NPM