handlebars-layout
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

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.

Package Sidebar

Install

npm i handlebars-layout

Weekly Downloads

181

Version

0.1.4

License

MIT

Last publish

Collaborators

  • vilicvane