A gulp plugin to wrap the stream contents with an ejs template.
Usage
First, install gulp-wrap-layout
as a development dependency:
npm install --save-dev gulp-wrap-layout
Then, add it to your gulpfile.js
:
Wrap the contents with an inline template:
var wrap = ; gulp ;
Wrap the contents with a template from file:
var wrap = ; gulp ;
Provide additional data and options for template processing:
var wrap = ; gulp ;
This gulp plugin wraps the stream contents in a template. If you want the stream contents to be the templates use the gulp-template plugin.
Template
The stream contents will be available in the template using the contents
key. Properties from the vinyl file will be available in the template under the file
object and are local to that stream. User supplied data
values will always take precedence over namespace clashes with the file properties.
API
wrap(template[,data][,options])
template
Type: String
or Object
The template to used. When a String
then it will be used as the template. When an Object
then the template will be loaded from file.
template.src
Type: String
The file location of the template.
data
Type: Object
The data object that is passed on to the ejs template call.
options
Type: Object
The options object that is passed on to the ejs template call.
wrap.ejs
Access the ejs object directly