Nightmarish Pawnshop Mystic
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    metalsmith-partialpublic

    metalsmith-partial

    A metalsmith plugin for a partial

    This plugin provide 'partial' helper to include other templates. You can use any templating engine supported by consolidate.js.

    Installation

    $ npm install metalsmith-partial

    Example

    Source file src/index.html:

    ---
    title: The title
    ---
    <p>The contents</p>
     
    {%- @partial('foobar.html') %}

    Partial partials/foobar.html:

    <p>This is a partial.</p>

    Build file build.js:

    var metalsmith = require('metalsmith');
    var partial = require('metalsmith-partial');
    var templates = require('metalsmith-templates');
     
    metalsmith(__dirname)
      .source('./src')
      .destination('./dest')
      .use(partial({
        directory: './partials', 
        engine: 'eco'
      }))
      .use(templates({
        engine: 'eco',
        inPlace: true
      }))
      .build();

    Results in dist/index.html:

    <p>The contents</p>
     
    <p>This is a partial</p>

    License

    MIT

    Keywords

    none

    install

    npm i metalsmith-partial

    Downloadslast 7 days

    35

    version

    0.1.0

    license

    MIT

    homepage

    github.com

    last publish

    collaborators

    • avatar