Git Product home page Git Product logo

Comments (5)

phated avatar phated commented on July 25, 2024 1

A custom registry can do tons of things.

How I would handle this:

  • Come up with a convention for internal tasks (like prefix with double underscore, e.g. __copyHtml)
  • Inside the custom registry's .set() method, check if the name has the double underscore, and if it does, add it to a separate object attached to your custom registry. Also, make sure to bind the context and return the newly bound function in this method.
  • Inside the custom registry's .get() method, check the name for double underscores and fetch out of the correct object.
  • Inside the custom registry's .tree() method, only return public tasks. This method is used for exposing things to the CLI.
  • Inside the custom registry's .init() method, register all tasks (public and private).

I think the above solution solves all your problems. The implementation for custom registries had a ton of thought behind it to allow you to implement these types of things but you need to think thoroughly about the solution. This is a highly advanced feature for gulp and you can do lots of wonderful and scary things.

from undertaker.

mikehaas763 avatar mikehaas763 commented on July 25, 2024

I threw something together to bind my functions before I passed them in to series and parallel and discovered that then makes my tasks tree say they are all the same function name. I'm guessing it relates to gulpjs/gulp#1159

As it is it looks to me like the cleanest solution is to just wrap in a factory function and close over the config parameter.

from undertaker.

mikehaas763 avatar mikehaas763 commented on July 25, 2024

Ok thanks that gave me some ideas. I'm going to see if I can find a way to do it without the abstraction enforcing the task functions to need to be prefixed with a double underscore.

from undertaker.

phated avatar phated commented on July 25, 2024

@mikehaas763 was this the same thing as #32 ? I'd like to close that one if so

from undertaker.

mikehaas763 avatar mikehaas763 commented on July 25, 2024

No it's not.

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.