Skip to content

Handlebars helpers which implement layout blocks similar to Jade, Jinja, Swig, and Twig.

Notifications You must be signed in to change notification settings

vilicvane/handlebars-layout

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Handlebars Layout

A fork of handlebars-layouts enables partial by path (Node.js).

Install

npm install handlebars-layout

Partial by Path

It will try to load partials of which the references start with either ./, ../ or / and not registered yet.

page.hbs

{{!-- reference a partial by path --}}
{{#extend "./layout"}}
    {{#content "header"}}
        <h1>Goodnight Moon</h1>
    {{/content}}
    {{#content "main" mode="append"}}
        <p>Dolor sit amet.</p>
    {{/content}}
    {{#content "footer" mode="prepend"}}
        <p>MIT License</p>
    {{/content}}
{{/extend}}

layout.hbs

<html>
    <body>
        {{#block "header"}}
            <h1>Hello World</h1>
        {{/block}}
        {{#block "main"}}
            <p>Lorem ipsum.</p>
        {{/block}}
        {{#block "footer"}}
            <p>&copy; 1999</p>
        {{/block}}
    </body>
</html>

Check out original repository for more usage.

License

MIT License.

Created by Shannon Moeller.
This fork is maintained by vilicvane.

About

Handlebars helpers which implement layout blocks similar to Jade, Jinja, Swig, and Twig.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%