metalsmith-auto-collections
A metalsmith plugin to automatically add files to collections based on parent directory
Last updated a month ago by lowmess .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install metalsmith-auto-collections 
SYNC missed versions from official npm registry.

metalsmith-auto-collections

Automatically use metalsmith-collections. The collection name is equal to the parent directory of each file.

Installation

npm install metalsmith-auto-collections [-D]

Usage

const Metalsmith = require('metalsmith')
const collect = require('metalsmith-auto-collections')

const ms = Metalsmith(__dirname)

// add all files to a collection
ms.use(collect())

// use globs to only set certain files to a collection
ms.use(
  collect({
    pattern: ['**/*.md', '!*.md'],
  })
)

// pass settings to `metalsmith-collections`
ms.use(
  collect({
    pattern: '**/*.md',
    settings: {
      sortBy: 'date',
      reverse: true,
    },
  })
)

// pass collections to metalsmith-collections (for manual collections)
ms.use(
  collect({
    collections: {
      navigation: {
        sortBy: 'ordering',
      },
    },
  })
)

To see the available options, see the metalsmith-collections repo.

Current Tags

  • 0.2.0                                ...           latest (a month ago)

8 Versions

  • 0.2.0                                ...           a month ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 28
Dependencies (3)
Dev Dependencies (6)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |