I want to log to stdout (the config environment) when a gulp task is running or has run.
Something like this:
gulp.task(\'scripts\', function () {
var
(PLEASE NOTE - In December 2017, the gulp-util
module was deprecated.)
To build on the answer by Jacob Budin, I recently tried this and found it useful.
var gulp = require("gulp");
var util = require("gulp-util");
var changed = require("gulp-changed");
gulp.task("copyIfChanged", function() {
var nSrc=0, nDes=0, dest="build/js";
gulp.src("app/**/*.js")
.on("data", function() { nSrc+=1;})
.pipe(changed(dest)) //filter out src files not newer than dest
.pipe(gulp.dest(dest))
.on("data", function() { nDes+=1;})
.on("finish", function() {
util.log("Results for app/**/*.js");
util.log("# src files: ", nSrc);
util.log("# dest files:", nDes);
});
}