Skip to content

thiagodemellobueno/metalsmith-include

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

metalsmith-include

Make the contents of other source files as properties on a metalsmith file object. Can be used as a rudimentary partial system for metalsmith-templates.

Example

index.md:

---
template: home.jade
include:
  thanks: thanks.md
---

### Welcome to my website!

home.jade:

.main
  !=contents

  .thanks
    !=thanks

thanks.md:

---
template: thanks.jade
partial: true
---

#### Thanks for visiting!

Output:

<div class="main">
  <h3>Welcome to my website!</h3>

  <div class="thanks">
    <h4>Thanks for visiting!</h4>
  </div>
</div>

Installation

$ npm install metalsmith-include

Options

The only option is deletePartials, which tells metalsmith-include whether or not to remove files that are included in other files, and have a partial indicator in their front-matter. Defaults to true.

CLI Usage

Install via npm and then add the metalsmith-include key to your metalsmith.json plugins with your options passed as an object:

{
  "plugins": {
    "metalsmith-include": {}
  }
}

Javascript Usage

Pass options to the include plugin and pass it to Metalsmith with the use method:

var include = require('metalsmith-include');

metalsmith.use(include());

License

MIT

About

Make the contents of other source files as properties on Metalsmith objects

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.3%
  • Makefile 2.7%