Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Adds support for Partials (re-usable templates) to DocPad

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .npmignore
Octocat-spinner-32 Cakefile
Octocat-spinner-32 History.md
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
README.md

Partials Plugin for DocPad

This plugin provides DocPad with Partials. Partials are documents which can be inserted into other documents, and are also passed by the docpad rendering engine.

Install

npm install --save docpad-plugin-partials

Usage

Setup

To use, first create the src/partials directory, and place any partials you want to use in there.

Then in our templates we will be exposed with the @partial(filename,data) function. The data argument is optional, and can be used to send custom data to the partial's template data. If you would like to send over the current document's template data, then do the following @partial(filename,@,data).

If your partial only needs to be rendered once per (re)generation then you can specify cacheable: true in the partial's meta data, doing so greatly improves performance.

Example

For instance we could create the file src/partials/hello.html.md.eco which contains **Hello <%=@name or 'World'%>**.

We could then render it by using <%-@partial('hello.html.md.eco')%> to get back <strong>Hello World</strong> or with <%-@partial('hello.html.md.eco',{name:'Apprentice'})%> to get back <strong>Hello Apprentice</strong>.

History

You can discover the history inside the History.md file

License

Licensed under the incredibly permissive MIT License
Copyright © 2012 Bevry Pty Ltd

Something went wrong with that request. Please try again.