gulp-notice

Add auto-generated notices to the top of your auto-generated files

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
gulp-notice
301.0.37 years ago7 years agoMinified + gzip package size for gulp-notice in KB

Readme

gulp-notice
Add auto-generated notices to the top of your auto-generated files.

Install it

npm install gulp-notice

Usage

You can use the default notice:
var gulp = require('gulp'),
    notice = require('gulp-notice');

gulp.task('default', function () {
    gulp.src('src/*.js')
        .pipe(notice())
        .pipe(gulp.dest('dist/'));
});
Which will prepend files with:
/* --------------------------------------------------------------------- *\
|  This code was auto-generated by a tool.                                |
|                                                                         |
|  Changes to this file may cause incorrect behavior and will be lost if  |
|  the code is regenerated.                                               |
\* --------------------------------------------------------------------- */
Or you can provide your own string as the first parameter:
var gulp = require('gulp'),
    notice = require('gulp-notice');

var text = '/* this file was auto-generated */';

gulp.task('default', function () {
    gulp.src('src/*.js')
        .pipe(notice(text))
        .pipe(gulp.dest('dist/'));
});
Which will prepend files with:
/* this file was auto-generated */

Working wth streams

If you're working with streams (e.g. vinyl-source-stream) then gulp-streamify will help you. Let's say you're using browserify with vinyl-source-stream, you can wrap gulp-notice with streamify and it'll work:
return b.bundle()
    .pipe(source(entry))
    .pipe(streamify(notice()))
    .pipe(gulp.dest('./public/js'));