Search code examples
gulpgulp-concat

gulp.src is not a function


I want to use gulp to concatenate and then minimize my Javascript files.

But I can not even get the first part to run. I keep getting an error that says "gulp.src is not a function".

I have gulp installed both globally and in the directory I am working with. And in a different directory I am using gulp to compile my Sass files just fine.

What is wrong with this task?

'use strict';

var gulp         = require('gulp'),
    concat       = require('gulp-concat');


/* Concatenate Javascript files needed to be referenced in the header. */
gulp.task("concatHeaderJS", function() {
   gulp.scr([                                 // what to concat, can also be strings
      'inc/js/zebra_dialog.js',               // order matters
      'inc/js/gx-zebra_dialog.js',
      'inc/js/gx-sidebar-nav.js'])
   .pipe(concat("header_files_concat.js"))    // where to send result
   .pipe(gulp.dest("inc/js"));                // folder for result to end in
});

Solution

  • Change gulp.scr to gulp.src. It's the typo life.