0.0.4 • Published 8 years ago

hogan-express-partials v0.0.4

Weekly downloads
110
License
MIT
Repository
-
Last release
8 years ago

hogan-express-partials

Express middleware for adding path-based partials support to hogan-express.

Install

Install hogan-express-partials using npm:

npm install hogan-express-partials

Usage

Setup

To use hogan-express-partials

var partials = require('hogan-express-partials');

app.set('views', path.join(settings.path, 'views'));
app.set('view engine', 'html');
app.set('layout', 'layouts/default');
app.engine('html', require('hogan-express'));

app.use(partials.middleware());

Using a path-based partial

In a layout or partial, you can include views-relative paths to other partials.

app.get '/', (req,res)->
  res.locals = name: 'Jacob'
  res.render 'template'

If layout.html contained:

<p>
  <strong>Message Layout</strong>
  {{{ yield }}}
</p>

and template.html contained:

<em>{{ name }} says {{> @components/message }}</em>

and message.html or message/index.html was located in the components folder under views and it contained

Hello World.

the callback would produce

<p>
  <strong>Message Layout</strong>
  <em>Jacob says Hello World.</em>
</p>

See hogan-express for more documentation.

0.0.4

8 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago