handlebars-extend-block
add extend blocks to handlebars
Last updated 6 years ago by shtylman .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install handlebars-extend-block 
SYNC missed versions from official npm registry.

handlebars-extend-block

Create extend blocks for handlebars allowing partials to inject text into parent elements. This is generally useful for script and style tags.

example

var handlebars = require('handlebars');
var extend = require('handlebars-extend-block');

handlebars = extend(handlebars);

Layout File

<head>
    <title>{{title}}</title>
    <link rel='stylesheet' href='/css/style.css'>
    {{{block "stylesheets"}}}
</head>

<body>
    {{{body}}}

    <hr/>
    post body
    <hr/>

    {{{block "scripts"}}}
</body>

Partial

{{#extend "stylesheets"}}
<link rel="stylesheet" href="/css/index.css"/>
{{/extend}}

let the magic begin

{{#extend "scripts"}}
<script>
document.write('foo bar!');
</script>
{{/extend}}

Current Tags

  • 1.0.0                                ...           latest (6 years ago)

1 Versions

  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 2
This Month 6
Last Day 2
Last Week 3
Last Month 4
Dependencies (0)
None
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |