New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

choo-layout

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

choo-layout

Layout middleware-ish type thing for choo

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

choo-layout is a way to wrap templates with other templates (yo dawg?)

The inspiration came from iron-router because I wanted to be able to have certain pages be contained within another without having to maintain each instance of the 'wrapper' template.


How to use it:

Create a layout:
const layout = require('choo-layout')

module.exports = layout`
      <div>
        <div class="row">here comes the train... :train:</div>
        <div>
          ${0}
        </div>
      </div>
      `

A layout can have multiple 'yields' (where the given page will go). Unfortunately there is no 'named' templates yet but it shouldn't be hard to add. (;))

Use a layout:

const layout = require('../views/layout')
const dashboard = require('../views/dashboard')

module.exports.boot = (app) => {
  app.router([
    ['/', layout(dashboard)]
  ])

  ...

Boom! You have a layout. If you wanted multiple templates in your layout, you would pass like you would pass an additional parameter to a function (because app.router doesn't need more arrays...)

FAQs

Package last updated on 17 Apr 2017

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