I'm attempting to pass through a "dummy" pipe function that simply passes through to the next pipe instance based on a conditional. I cannot use gulp-if
as I need sourcemaps support, so my current task looks like this:
module.exports = (gulp, $, browserSync, reload, merge, paths, files) ->
->
nullFunc = ->
transform = (file, cb) ->
cb()
return
return
uglify = if @seq[0] is 'coffeeprod' then $.uglify() else nullFunc()
gulp.src(files.app)
.pipe($.changed(paths.scripts.build))
.pipe($.sourcemaps.init())
.pipe($.concat('app.coffee'))
.pipe($.coffee(join: true).on('error', $.util.log))
.pipe(uglify)
.pipe($.sourcemaps.write('../sourcemaps'))
.pipe($.size(
showFiles: true
title: 'Coffee:'))
.pipe gulp.dest(paths.scripts.build)
What's not working is my nullFunc()
as I'm getting a TypeError: Cannot read property 'on' of undefined
error. Any tips on a dummy function or the best way to get around the uglify()
function not firing would be greatly appreciated. Thanks!