Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API docs missing gulp.start() #755

Closed
dman777 opened this issue Nov 5, 2014 · 14 comments
Closed

API docs missing gulp.start() #755

dman777 opened this issue Nov 5, 2014 · 14 comments

Comments

@dman777
Copy link

dman777 commented Nov 5, 2014

Unless I am having a off day and missing it, it seems gulp.start() is missing from the api docs.

@pkozlowski-opensource
Copy link
Contributor

I think that the start method is on the gulp namespace a bit "by accident" as in reality this is part of the Orchestrator API and gulp inherits from Orchestrator.

I don't think exposing start as public API is what we want to do as the run method is going away in Gulp4 with a new task system.

In short: I don't think it is intended to be Gulp's public API and thus I don't think it should be documented.

@dman777
Copy link
Author

dman777 commented Nov 5, 2014

Thank you.

What would be an alternative/more proper way to write this to call it from command line? example: gulp foobar

gulp.task('foobar', function () {
    //index is a separate gulp task
    streamReturned = gulp.start('index');
    //do more stuff with `strestreamReturned`;
});

@pkozlowski-opensource
Copy link
Contributor

I would extract the common part of the foobar and index tasks and invoke this function from both tasks. Gulp files is, after all, just a node.js program. Gulp4 will, hopefully, make it more clear that a task is just a function.

At any rate, your problem sounds like a general support question and as such would be better ask on StackOverflow.

@dman777
Copy link
Author

dman777 commented Nov 5, 2014

👍

@justinmchase
Copy link

Start seems like a good api to use in watch tasks. Is there a better way to do this?

gulp.task('watch', () => {
  var sources = [...]
  gulp.watch(sources, ['test'])
  gulp.start('test')
})

If you put test as a dependency instead of invoke via gulp.start then the process will exit if a test fails and watch is never invoked. But this way you will get your tests running immediately but watch will continue to run. This seems like a legitimate enough scenario to add this function to the docs, I had to search for a while to find out how to do this satisfactorily.

@phated
Copy link
Member

phated commented Mar 19, 2016

@justinmchase start is the only way to do what you want in gulp 3 but it was never officially supported by gulp (it was exposed by a dependency) and is completely gone in gulp 4. I don't suggest using it.

@justinmchase
Copy link

how would you do it in gulp 4, for reference?

@phated
Copy link
Member

phated commented Mar 19, 2016

@justinmchase everything in gulp 4 is just a function, you just call it

@justinmchase
Copy link

I see, thanks.

erquhart pushed a commit to netlify-templates/victor-hugo that referenced this issue Feb 22, 2018
gulp.start() is never officially supported by gulp, it's better to use the functionality provided by gulp.watch(). 

See: gulpjs/gulp#755
tdhopper pushed a commit to olneyhymn/quotes that referenced this issue Mar 23, 2018
gulp.start() is never officially supported by gulp, it's better to use the functionality provided by gulp.watch(). 

See: gulpjs/gulp#755
modille added a commit to samoyed-health-foundation/website that referenced this issue Apr 5, 2018
Remove use gulp.start()

gulp.start() is never officially supported by gulp, it's better to use the functionality provided by gulp.watch().

See: gulpjs/gulp#755
mbland pushed a commit to mbland/slush that referenced this issue May 26, 2018
Gulp 4.0.0 switched its task execution engine from `orchestrator` to
`undertaker`. As a result, certain methods and events from Gulp 3.9.1
upon which `slush` depended disappeared:

  gulpjs/gulp#755

Supporting Gulp 4.0.0 is important because Node 10 broke the
`graceful-fs` package upon which Gulp 3.9.1 depends. While there's a
workaround (updating the `natives` package), it places a burden on users
that still doesn't guarantee that Gulp 3.9.1 will remain future-proof:

  gulpjs/gulp#2146 (comment)
  gulpjs/gulp#2162 (comment)
  nodejs/node#19786 (comment)

As it turned out, the changes required to support both versions were
fairly straighforward, and should ensure that Slush remains future-proof
until the next major Gulp update.
mbland pushed a commit to mbland/slush that referenced this issue May 29, 2018
Gulp 4.0.0 switched its task execution engine from `orchestrator` to
`undertaker`. As a result, certain methods and events from Gulp 3.9.1 upon which
`slush` depended disappeared:

  gulpjs/gulp#755

Supporting Gulp 4.0.0 is important because Node 10 broke the `graceful-fs`
package upon which Gulp 3.9.1 depends. While there's a workaround (updating the
`natives` package), it places a burden on users that still doesn't guarantee
that Gulp 3.9.1 will remain future-proof:

  gulpjs/gulp#2146 (comment)
  gulpjs/gulp#2162 (comment)
  nodejs/node#19786 (comment)

As it turned out, the changes required to support both versions were fairly
straighforward, and should ensure that Slush remains future-proof until the next
major Gulp update.

NOTE: The test tasks are now all asynchronous via a `done` callback, since Gulp
4 doesn't support synchronous tasks. Any synchronous slushfile task will need to
be updated.
tdhopper added a commit to olneyhymn/quotes that referenced this issue Jun 13, 2018
gulp.start() is never officially supported by gulp, it's better to use the functionality provided by gulp.watch(). 

See: gulpjs/gulp#755
@felixfbecker
Copy link

felixfbecker commented Jul 17, 2018

everything in gulp 4 is just a function, you just call it

@phated Is there a way to make Gulp log the standard Starting 'taskName'/Finished 'taskName' after XXms when doing so?

@demurgos
Copy link
Member

demurgos commented Jul 18, 2018

Is your use case related to the watch mode or is it about simply starting the tasks programmatically? There was a recent issue for this to trigger gulp tasks programmatically that got shut down (simply call the functions, as mentioned above).

The logs are handled at the CLI level. I don't think there's way to trigger them when calling the task function programmatically.

I'd recommend to open a new issue if you want to request this feature instead of replying to an old issue. If this is just a support question, it's better suited for Stack Overflow. (Due to the high number of issues, this tracker is only intended for bugs)

@felixfbecker
Copy link

It's a watch use case, but when not using gulp.watch(), but e.g. webpack's watch API. After the webpack compilation is done I also need to trigger some other tasks.

@demurgos
Copy link
Member

Seems like a valid use case to me but I am not sure if it is possible currently.

@phated
Copy link
Member

phated commented Jul 18, 2018

Shell out or refactor your project. This is not a support forum so I'm going to lock this.

@gulpjs gulpjs locked and limited conversation to collaborators Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants