Package Exports
- layouts
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (layouts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
layouts 
Wrap templates with layouts. Layouts can be nested and optionally use other layouts.
Install
Install with npm
npm i layouts --save
Usage
var layouts = require('layouts');
API
Heads up! Although most of the examples use <%= foo %>
syntax for delimiters, you can change these to be whatever you need.
.layouts
Given an object of layouts
, and the name
of a starting layout:
str
{String}: The content string that should be wrapped with a layout.name
{String}: The name of the layout to use.layout{s}
{Object}: Object of layouts.name
should be a key on this object.options
{Object}delims
{Object}: Custom delimiters to use.defaultLayout
{Object}: Default layout to use.
returns
{String}: Returns the original string, wrapped with a layout, or layout stack.- build a layout stack (array of layouts) for the given
string
, then - iterate over the stack, wrapping each layout in the stack around the string
- return the string with layouts applied
- build a layout stack (array of layouts) for the given
Example
layouts('<div>This is content</div>', 'base', {base: {content: 'base above\n{% body %}\nbase below'}});
Results in:
base above
<div>This is content</div>
base below
Author
Jon Schlinkert
License
Copyright (c) 2014 Jon Schlinkert
Released under the MIT license
This file was generated by verb on November 17, 2014.