Git Product home page Git Product logo

Comments (4)

TrySound avatar TrySound commented on July 25, 2024

By the way I was able to use null dependencies in gulp3

gulp.task('build', env.clean ? ['clean'] : null, function (done) {done();});

from undertaker.

phated avatar phated commented on July 25, 2024

I'm not sure how I feel about this. It goes against functional composition. Why not just use a named function called noop or something?

from undertaker.

TrySound avatar TrySound commented on July 25, 2024

I wouldn't like to see noop in log, caz it's nothing do. Maybe some gulp.noop() which will be ignored in log?

from undertaker.

phated avatar phated commented on July 25, 2024

@TrySound I've thought about this some more and I don't think this case should be supported. By "nulling" out some tasks, you will be screwing up the tasks listed by gulp --tasks because the dependency trees are built when the gulpfile is loaded and the task listing loads the gulpfile. This is something you can still do but I don't think the average user should be doing it, as it can be confusing and I don't want to adjust the API to make it easier for them to get confused.

The recommended way for this would be to put an early return in your task and maybe use gulplog to log a skipped message. You could make this into an interesting helper; maybe something like:

function skippable(condition, fn){
  if (!condition) {
    return fn;
  }

  function skipped(cb){
    cb();
  }
  skipped.displayName = (fn.name || fn.displayName) + ' (skipped)';
  return skipped;
}

function clean(cb){ ... }

gulp.task(skippable(env.clean, clean));

from undertaker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.