Skip to content

defunctzombie/handlebars-extend-block

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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}}

About

create extend blocks for handlebars

Resources

License

Stars

Watchers

Forks

Packages

No packages published