layouts
Wrap templates with layouts. Layouts can be nested and optionally use other layouts.
Install with npm
npm i layouts --save
Usage
var layouts = require('layouts');
Usage
var stack = {
foo: {content: 'foo above\n{% body %}\nfoo below', layout: 'bar'},
bar: {content: 'bar above\n{% body %}\nbar below', layout: 'baz'},
baz: {content: 'baz above\n{% body %}\nbaz below'},
};
layouts('<div>This is content</div>', 'foo', stack);
Results in:
baz above
bar above
foo above
<div>This is content</div>
foo below
bar below
baz below
API
str
{String}: The content string to be wrapped with a layout.key
{String}: The object key of the starting layout.templates
{Object}: Object of layouts.options
{Object}
layoutDelims
{Object}: Custom delimiters to use.defaultLayout
{Object}: The name (key) of the default layout to use.
returns
{String}: String wrapped with a layout or layouts.
Wrap a string with a layout, or multiple layouts.
Related
- template: Render templates from any engine. Make custom template types, use layouts on pages, partials or any custom template type, custom delimiters, helpers, middleware, routes, loaders, and lots more. Powers Assemble v0.6.0, Verb v0.3.0 and your application.
- assemble: Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt, Less.js / lesscss.org, Topcoat, Web Experience Toolkit, and hundreds of other projects to build sites, themes, components, documentation, blogs and gh
- verb: Verb makes it dead simple to generate markdown documentation, using simple templates, with zero configuration required. A project without documentation is like a project that doesn't exist.
- handlebars-helpers: 120+ Handlebars helpers in ~20 categories, for Assemble, YUI, Ghost or any Handlebars project. Includes helpers like {{i18}}, {{markdown}}, {{relative}}, {{extend}}, {{moment}}, and so on.
- template-helpers: Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or any engine that supports helper functions.
Running tests
Install dev dependencies.
npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Brian Woodward
License
Copyright (c) 2014-2015 Brian Woodward
Released under the MIT license
This file was generated by verb-cli on March 07, 2015.