Node's del command - callback not firing

后端 未结 3 940
栀梦
栀梦 2021-01-01 16:18

I\'m working through a pluralsight course on gulp. John Papa is demonstrating how to inject a function that deletes existing css files, into the routine that compiles the n

3条回答
  •  盖世英雄少女心
    2021-01-01 17:08

    Checking the docs for the del package it looks like you're getting mixed up between node's standard callback mechanism and del's, which is using a promise.

    You'll want to use the promise API, with .then(done) in order to execute the callback parameter.

    Node and javascript in general is currently in a bit of a state of flux for design patterns to handle async code, with most of the browser community and standards folks leaning towards promises, whereas the Node community tends towards the callback style and a library such as async.

    With ES6 standardizing promises, I suspect we're going to see more of these kinds of incompatibilities in node as the folks who are passionate about that API start incorporating into node code more and more.

提交回复
热议问题