Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

layouts

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

layouts

Wrap templates with layouts. Layouts can be nested and optionally use other layouts.

  • 0.7.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33K
increased by17.16%
Maintainers
2
Weekly downloads
 
Created
Source

layouts NPM version

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

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

API

layouts(string, name, layouts);

Given an object of layouts, and the name of a starting layout:

  1. build a layout stack (from the layouts object) for the given string, then
  2. iterate over the stack, wrapping each layout in the stack around the string
  3. return the string with layouts applied

.layouts

  • 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}
    • layoutDelims {Object}: Custom delimiters to use.
    • defaultLayout {Object}: Default layout to use.
  • returns {String}: Returns the original string, wrapped with a layout, or layout stack.

Author

Brian Woodward

License

Copyright (c) 2014-2015 Brian Woodward
Released under the MIT license


This file was generated by verb on February 13, 2015.

Keywords

FAQs

Package last updated on 13 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc