gulp-layoutize
v0.0.4
Published
Render contents of input files through a templating engine (powered by consolidate.js)
Downloads
13
Maintainers
Readme
gulp-layoutize
Render contents of input files through a templating engine (powered by consolidate.js)
Usage
First, install gulp-layoutize
as a development dependency:
npm install --save-dev gulp-layoutize
Then, add it to your gulpfile.js
:
var layoutize = require("gulp-layoutize");
gulp.src("./src/*.ext")
.pipe(layoutize({
templatePath: 'path/to/template',
engine: 'templatingEngine',
locals: {}
}))
.pipe(gulp.dest("./dist"));
API
layoutize(options)
Either define options.templatePath
or options.template
. If both are given, options.templatePath
is used.
options.templatePath
Type: String
Default: undefined
Required: true
Path to template.
options.template
Type: String
Default: undefined
Required: true
Template content.
options.engine
Type: String
Default: undefined
Required: true
Provide the templating engine name as supported by consolidate.js
.
options.locals
Type: Object
Default: {}
Required: true
The locals object is passed as template variables to the templating engine. Refer to the templating engine guides on how to use variables in the template. Also, you have some predefined locals, refering to the current file:
- content (String): content of the current file
- file (Object): vinyl file object with filename, path, etc.