运行 gulp-gulp v4 中的 nodemon
Running gulp-nodemon in gulp v4
我一直在阅读 gulp-nodemon,但所有语法都是针对 gulp 的先前版本的,我正在尝试 运行 它在 V4 上。
这就是我 运行宁:
function watcher (genCSS,js) {
nodemon({
script: './app.js' ,
ext: 'js scss',
ignore: [ 'public/dist/', 'node_modules/' ],
watch: [tpath.src.js, tpath.src.scss],
tasks: function (changedFiles) {
var tasks = [genCSS,js]
})
return tasks
} })
}
错误是:
Task never defined: function done() {
d.removeListener('error', onError);
d.exit();
return tryCatch(cb, arguments);
}
出了什么问题?
已通过阅读 this issue on github 解决,您必须导出函数,并将它们添加为字符串。代码是:
function watcher (genCSS,js) {
nodemon({
script: './app.js' ,
ext: 'js scss',
ignore: [ 'public/dist/', 'node_modules/' ],
watch: [tpath.src.js, tpath.src.scss],
done:done,
tasks: function (changedFiles) {
var tasks = [genCSS,js]
})
return tasks
}
现在
function watcher () {
nodemon({
script: './app.js' ,
ext: 'js scss',
ignore: [ 'public/dist/', 'node_modules/' ],
watch: [tpath.src.js, tpath.src.scss],
done:done,
tasks: function (changedFiles) {
var tasks = ['genCSS','js']
})
return tasks
}
exports.genCSS=genCSS
exports.js=js
我一直在阅读 gulp-nodemon,但所有语法都是针对 gulp 的先前版本的,我正在尝试 运行 它在 V4 上。
这就是我 运行宁:
function watcher (genCSS,js) {
nodemon({
script: './app.js' ,
ext: 'js scss',
ignore: [ 'public/dist/', 'node_modules/' ],
watch: [tpath.src.js, tpath.src.scss],
tasks: function (changedFiles) {
var tasks = [genCSS,js]
})
return tasks
} })
}
错误是:
Task never defined: function done() {
d.removeListener('error', onError);
d.exit();
return tryCatch(cb, arguments);
}
出了什么问题?
已通过阅读 this issue on github 解决,您必须导出函数,并将它们添加为字符串。代码是:
function watcher (genCSS,js) {
nodemon({
script: './app.js' ,
ext: 'js scss',
ignore: [ 'public/dist/', 'node_modules/' ],
watch: [tpath.src.js, tpath.src.scss],
done:done,
tasks: function (changedFiles) {
var tasks = [genCSS,js]
})
return tasks
}
现在
function watcher () {
nodemon({
script: './app.js' ,
ext: 'js scss',
ignore: [ 'public/dist/', 'node_modules/' ],
watch: [tpath.src.js, tpath.src.scss],
done:done,
tasks: function (changedFiles) {
var tasks = ['genCSS','js']
})
return tasks
}
exports.genCSS=genCSS
exports.js=js