gulp-header-license
v1.0.12
Published
Gulp extension to add license to file(s) in the pipeline.
Downloads
2,981
Readme
gulp-header-license
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.