Skip to content

garrows/gulp-headerfooter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-headerfooter Build Status NPM version

A gulp plugin for adding headers and footers to your files

Install

Install with npm.

npm install --save-dev gulp-headerfooter

Examples

Filenames as the header & footer

var gulp = require('gulp');
var headerfooter = require('gulp-headerfooter');

gulp.task('default', function () {
	gulp.src('./app/content')
		.pipe(headerfooter.header('./app/partials/header.html'))
		.pipe(headerfooter.footer('./app/partials/footer.html'))
        .pipe(gulp.dest('./public/'));
});

Strings as the header & footer

var gulp = require('gulp');
var headerfooter = require('gulp-headerfooter');

gulp.task('default', function () {
    gulp.src('./app/content')
        .pipe(headerfooter.header('<html><body>'))
        .pipe(headerfooter.footer('</body></html>'))
        .pipe(gulp.dest('./public/'));
});

Buffers as the header & footer

var gulp = require('gulp');
var headerfooter = require('gulp-headerfooter');
var fs = require('fs');

var header = fs.readFileSync('./app/partials/header.html');
var footer = fs.readFileSync('./app/partials/footer.html');

gulp.task('default', function () {
    gulp.src('./app/content')
        .pipe(headerfooter.header(header))
        .pipe(headerfooter.footer(footer))
        .pipe(gulp.dest('./public/'));
});

Short hand version

var gulp = require('gulp');
var headerfooter = require('gulp-headerfooter');

gulp.task('default', function () {
    gulp.src('./app/content')
        .pipe(headerfooter('<html><body>', '</body></html>')
        .pipe(gulp.dest('./public/'));
});

Testing

Run the units tests with

npm test

About

A gulp plugin for adding headers and footers to your files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published