Skip to content

bigpipe/bigpipe-layout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This plugin is deprecated, as the new pagelet-only structure, will provide the same functionality through the bootstrap Pagelet

Layout Build Status NPM version Coverage Status

Bigpipe plugin that will provide an easy method to add a general layout to pages. The Bigpipe#Temper instance is used to load your provided layout. The template engine of the file is automatically detected. The page is supplied to the layout as partial by default, changable through options#key.

Features

  • Provide default layout to each page
  • Utilizes Bigpipe#Temper to automatically detect the template engine
  • Fully customizable layout page, options provide full control

Example of layout file using the embedded js template egine

<div><%- partial %></div>

Installation

The layout plugin is released to npm and can be installed using:

npm install bigpipe-layout --save

To use the plugin from Bigpipe, simply add it after Bigpipe is initialized or add it to options#plugins. bigpipe.use will execute the plugin logic. Make sure the plugin name is unique, e.g. layout by default.

// Usage after initialization
var layout = require('bigpipe-layout')
  , BigPipe = require('bigpipe');

//
// Add valid path to base layout.
//
layout.options = { base: '/path/to/base/layout.ejs' };
layout.key = 'custom';

var pipe = new BigPipe(http.createServer(), {
  pages: __dirname + '/pages',
  public: __dirname + '/public'
}).listen(8080).use(layout);
// Usage through createServer options
var layout = require('bigpipe-layout')
  , BigPipe = require('bigpipe');

//
// Add valid path to base layout.
//
layout.options = { base: '/path/to/base/layout.ejs' };

var pipe = BigPipe.createServer(8080, {
  pages: __dirname + '/pages',
  public: __dirname + '/public',
  plugins: [ layout ]
});

License

MIT

About

Supply default layout to Bigpipe pages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published