Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

gulp-header-license

1.0.9 • Public • Published

gulp-header-license NPM version

License plugin for Gulp. gulp-header-license is a Gulp extension to add a header license to file(s) in the pipeline.

Install

npm install gulp-header-license --save-dev

Basic Usage

Something like this will add license to your file(s):

var gulp = require("gulp");
var license = require('gulp-header-license');
 
gulp.task('license', function () {
    var year = (new Date()).getFullYear();
    gulp.src('./assets/**/*.js')
            .pipe(license('Copyright (c) ${year}, B3log.org', {year: year}))
            .pipe(gulp.dest('./public/'));
});

You can also use header.txt, doing something like this:

'use strict';
 
var gulp = require("gulp");
var license = require('gulp-header-license');
var fs = require('fs');
 
gulp.task('license', function () {
    var year = (new Date()).getFullYear();
    gulp.src('./assets/**/*.js')
            .pipe(license(fs.readFileSync('header.txt', 'utf8'), {year: year}, 0.9))
            .pipe(gulp.dest('./public/'));
});

Options

license:String

The license template string.

config:JSON

The JSON object used to populate the license template.

rate:Float, default value is 0.8.

Less then this rate, add license, otherwise update license.

Install

npm i gulp-header-license

DownloadsWeekly Downloads

622

Version

1.0.9

License

Apache License

Last publish

Collaborators

  • avatar