A few seconds.


Gulp extension to add header to file(s) in the pipeline.

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.name %> - <%= 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

Pincer is a project which aims to provide best library discovery tools for developers. We're growing day by day. We have only npm platform for now but we will add the others as much as we can.