metalsmith-nestedlayouts

2.2.2 • Public • Published

metalsmith-nestedlayouts

build status coverage status

A metalsmith plugin for nested layouts

This plugin modifies the behavior of metalsmith-layout.

It reads from collection rather than files

There are 2 distinct advantages to this behavior:

  1. You can add frontmatter to layouts
  2. Which means you can nest layouts inside another by adding a layout property in a layout

It analyzes layouts dependency and renders layouts in correct order

It checks whether or not layouts directory is inside the Metalsmith source

Therefore it won’t reread the layouts that had already been read by the Metalsmith instance.

Usage

Refer to metalsmith-layout doc for the usage. This plugin does not break the original API and can simply replace it. The only meaningful additions are that you may now add a layout property inside a layout, and that you may set directory to a subdirectory of source. If you do, you probably want to delete the layouts from the Metalsmith output because they serve no practical purpose. Example:

Metalsmith
  .source('./src')
  .use(layouts({ directory: 'src/layouts' }))
  .use(ignore('src/layouts/*'))

Credits

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i metalsmith-nestedlayouts

Weekly Downloads

0

Version

2.2.2

License

MIT

Unpacked Size

26 kB

Total Files

7

Last publish

Collaborators

  • yuchoho