Track the duration of parts of your gulp tasks
Track the duration of parts of your gulp tasks.
Useful, for example, when running a periodic watch-like task but not using
gulp.watch or gulp's task dependency system.
Creates a new pass-through duration stream. When this stream is closed, it will log the amount of time since its creation to your terminal.
Optionally, you can pass a
name to use when logging – defaults to
Resets the stream's "start time" to the current time. Use this in your pipeline to only track the duration after a certain event.
Here's a simple example:
var duration = require'gulp-duration'var uglify = require'gulp-uglify'var concat = require'gulp-concat'var gulp = reuqire'gulp'gulptask'interval'setIntervalgulpsrc'./*.js'pipeconcatpipeuglifypipeduration'rebuilding files'pipegulpdest'./dist'5000
And something a little less trivial:
var source = require'vinyl-source-stream'var uglify = require'gulp-uglify'var watchify = require'watchify'var gulp = require'gulp'gulptask'example'var bundler = watchifyentries: './index.js'on'update' rebundlereturn rebundlevar uglifyTimer = duration'uglify time'var bundleTimer = duration'bundle time'return bundlerbundlepipesource'bundle.js'pipebundleTimer// start just before uglify recieves its first fileonce'data' uglifyTimerstartpipeuglifypipeuglifyTimerpipegulpdest'example/'
MIT. See LICENSE.md for details.