Socket
Socket
Sign inDemoInstall

gulp-header-comment

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-header-comment

Gulp plugin to add header comments to files


Version published
Weekly downloads
918
decreased by-33.77%
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 15 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc