Of course they can get a lot more complicated too. That’s what makes Metalsmith powerful; the plugins can do anything you want.

Install it

Metalsmith and its plugins can be installed with npm:

$ npm install metalsmith

The package exposes both a Javascript API, and CLI in case you’re used to that type of workflow from other static site generators. To see how they’re used check out the examples.

A Little Secret

We keep referring to Metalsmith as a “static site generator”, but it’s a lot more than that. Since everything is a plugin, the core library is actually just an abstraction for manipulating a directory of files.

Which means you could just as easily use it to make…

A Project Scaffolder

Read template files from a directory.

Parse files for template placeholders.

Prompt user to fill in each placeholder.

Render files with a templating engine.

Write filled-in files to a new directory.

A Build Tool

Read files from a source directory.

Convert Sass files to CSS.

Concatenate CSS files.

Minify the CSS file.

Compress images files.

Sprite images in a certain folder.

Write files to a public directory.

An eBook Generator

Read chapter files from a directory.

Build a table of contents from the tree.

Convert Markdown to HTML.

Convert Markdown to PDF.

Convert Markdown to ePUB.

Convert Markdown to MOBI.

Write compiled files to a directory.

Technical Docs

Read files from a source directory.

Convert Markdown files to HTML.

Build a navigation from the tree.

Render each file with a template.

Write HTML to the static directory.

The plugins are all reusable. That PDF generator plugin for eBooks? Use it to generate PDFs for each of your blog posts too!