gulp-extract
A gulp plugin for extracting file contents into a hash
Usage
Install gulp-extract
as a development dependency:
npm install gulp-extract --save-dev
Extracting file contents
Given the following directory structure:
├── gulpfile.js # Your gulpfile
└── src/ # Your application's source files
└── layouts/ # A folder containing layouts
└── root.hbs
└── docs.hbs
└── home.hbs
gulpfile.js
var extract = ; gulp;
Running the above gulp task would result in the hash containing 3 variables, each with the contents of the file:
console.log(hash.root);
console.log(hash.docs);
console.log(hash.home);
Example
A real world example of using this plugin, is combining it with the
gulp-handlebars-extended
plugin.
gulpfile.js
var extract = ;var hbx = ; gulp;