Gulp extension to add a header to file(s) in the pipeline
Pull request Compare This branch is 97 commits ahead of douglasduteil:master.
Latest commit 586e2a2 Oct 25, 2016 @tracker1 committed on GitHub Update package.json
update my email, haven't had access to godaddy email for a couple years.

gulp-header NPM version Build Status

gulp-header is a Gulp extension to add a header to file(s) in the pipeline. Gulp is a streaming build system utilizing node.js.


npm install --save-dev gulp-header


// assign the module to a local variable
var header = require('gulp-header');

// literal string
// NOTE: a line separator will not be added automatically

// ejs style templating
  .pipe(header('Hello <%= name %>\n', { name : 'World'} ))

// ES6-style template string
  .pipe(header('Hello ${name}\n', { name : 'World'} ))

// using data from package.json
var pkg = require('./package.json');
var banner = ['/**',
  ' * <%= %> - <%= pkg.description %>',
  ' * @version v<%= pkg.version %>',
  ' * @link <%= pkg.homepage %>',
  ' * @license <%= pkg.license %>',
  ' */',

  .pipe(header(banner, { pkg : pkg } ))

// reading the header file from disk
var fs = require('fs');
  .pipe(header(fs.readFileSync('header.txt', 'utf8'), { pkg : pkg } ))

Issues and Alerts

My handle on twitter is @tracker1 - If there is an urgent issue, I get twitter notifications sent to my phone.


header(text, data)


Type: String Default: ''

The template text.


Type: Object Default: {}

The data object used to populate the text.

In addition to the passed in data, file will be the stream object for the file being templated against and filepath will be the path relative from the stream's basepath.

NOTE: using false will disable template processing of the header