gulp-layout
Gulp plugin to switch layout files for each content (like a jekyll). We can use many template engines thanks to consolidate.js.
Install
npm install gulp-layout
Usage
Simple task to build html
var gulp = ;var layout = ; gulp;
(src) test.html:
gulp
(layout) post.pug:
h1= title|!= contents
(dist) test.html:
Hello Worldgulp
Like a jekyll
Use gulp-markdown & gulp-front-matter (thanks!)
var gulp = ;var frontMatter = ;var markdown = ;var layout = ; gulp;
(src) test.md:
---title: Hello Worldlayout: post.pug--- gulp
(layout) post.pug:
doctype htmlhtml head title= title body != contents
(dist) test.html:
Hello World gulp
More example: see examples
.
Options
layout(options)
options
{Object}layout
{String}: File path of template. If not setengine
, select the template engine by this extension.engine
{String}: Name of template engine. Use this option if cannot decide the engine bylayout
. For example, the extension oflayout
is.html
layout(func)
func
{Function}: Please returnoptions
. It will be called with the file.