1.1.1 • Published 7 years ago

metalsmith-another-source v1.1.1

Weekly downloads
20
License
GPL-3.0
Repository
github
Last release
7 years ago

metalsmith-another-source

A Metalsmith plugin that allows you to specify more than one sources for your input files.

Useful when you need to load additional files from another directory, than your source directory.

Installation

  $ yarn add metalsmith-another-source

Usage

Use before other middlewares to work with loaded files, so make it the first .use in your Metalsmith middleware chain.

  const anotherSource = require('metalsmith-another-source')

  ... 
  
  Metalsmith(__dirname)
  .source('./source')
  .destination('../tmp')

  .use(anotherSource('./another-source'))
  
  ...
  

API

anotherSource(directory , pattern)

Returns a plugin.

directory (String)
A path to the directory to be added as another source. Is relative to Metalsmith directory set with Metalsmith(...).

pattern (Regexp)
Regexp matching files to be included. When not present, all files in directory will be included.