gulp-append-data
Append content of JSON file to streamed file object. Useful in combination with gulp-consolidate.
Usage
First, install gulp-append-data
as a development dependency:
npm install --save-dev gulp-append-data
Then, add it to your gulpfile.js
:
var appendData = ;var consolidate = ; gulp;
Now the content of app/test.json
will be available when compiling app/test.html
.
Example
app/test.json
app/test.html
{{ foo }}
dist/test.html
bar
API
appendData(options)
options.property
Type: String
File object property to save the JSON to (optional, defaults to data
).
options.getRelativePath
Type: Function
Path of JSON file relative to streamed file (optional, defaults to function(file) { return util.replaceExtension(path.basename(file.path), '.json'); }
, see example above).