1

I try to add a header to every js-file in my project.

The current files are without comments in header. I want a gulp-task to insert following header to the files:

/*
 * New Comment from Gulp-Task
 */

Is there a plugin, already ? Gulp-Inject is maybe the solution, but I don´t know, how to use it for javascript injection.

Dominik
  • 299
  • 6
  • 18

2 Answers2

1

This is not a straight answer to your question as it requires some translation to your case, but here is a post on how to update version numbers (in your case, something else) within javascript files.

How to Increment Version Number via Gulp Task?

The second part to this answer is where you'll find your clue.

Community
  • 1
  • 1
Wilmer SH
  • 1,417
  • 12
  • 20
-2

I found the solution that work for me:

gulp.src(['./**/*.js'])
    .pipe(insert.prepend(license))
    .pipe(gulp.dest('./'));

It prepend a license head to every .js files in this directory and sub folders.

Dominik
  • 299
  • 6
  • 18