[go: up one dir, main page]

gulp-header-comment

0.10.0 • Public • Published

gulp-header-comment

Greenkeeper badge Build Status Npm version

gulp-header-comment is a Gulp extension to add comments to file(s) in the pipeline.

Install

npm install --save-dev gulp-header-comment

Usage

const headerComment = require('gulp-header-comment');

gulp.src('**/*.js')
  .pipe(headerComment('License MIT'))
  .pipe(gulp.dest('./dist/'))

The generated comment will use:

  • Block comment for JS, LESS, CSS and SASS files (i.e starts with /** and ends with */).
  • HTML comments for HTML files (i.e starts with <!-- and ends with -->).
  • Hash comments for appcache and hidden files (i.e starts with #).
  • The default is the block comment otherwise.

See https://github.com/3rd-Eden/commenting, as this package is used to generate comments according to file extensions.

Templating

Header strings can use lodash, moment and data from package.json:

const headerComment = require('gulp-header-comment');

gulp.src('**/*.js')
  .pipe(headerComment(`
    License: <%= pkg.license %>
    Generated on <%= moment().format('YYYY') %>
    Author: <%= _.capitalize(pkg.author) %>
  `))
  .pipe(gulp.dest('./dist/'))

You can also point to a file on disk:

const headerComment = require('gulp-header-comment');

gulp.src('**/*.js')
  .pipe(headerComment({
    file: path.join(__dirname, 'header.txt'),
    encoding: 'utf-8', // Default is UTF-8
  }))
  .pipe(gulp.dest('./dist/'))

ChangeLogs

See here.

License

MIT License (MIT)

Contributing

If you find a bug or think about enhancement, feel free to contribute and submit an issue or a pull request.

Readme

Keywords

Package Sidebar

Install

npm i gulp-header-comment

Weekly Downloads

5,588

Version

0.10.0

License

MIT

Unpacked Size

57.5 kB

Total Files

5

Last publish

Collaborators

  • mickael.jeanroy