Gulpが新しく、Gulpfile.jsのサンプルが見つかりました。変更が発生したときにエクスプレスアプリケーションのサーバーをlivereloadするapp.js
ファイルまたは./public
ディレクトリです。私はそれが私たいようGulp Fixサーバーライブリロード用の "gulp.run()は推奨されていません"
gulp.run() has been deprecated. Use task dependencies or gulp.watch task triggering instead.
ガルプが働いていると、それは、Webアプリケーションをlivereloadingされています。私は次の警告を得続ける私の端末ウィンドウで
var gulp = require('gulp'),
spawn = require('child_process').spawn,
node;
/**
* $ gulp server
* description: Launch the server. If there's a server already running, kill it.
*/
gulp.task('server', function() {
if (node) node.kill()
node = spawn('node', ['app.js'], {stdio: 'inherit'})
node.on('close', function (code) {
if (code === 8) {
gulp.log('Error detected, waiting for changes...');
}
});
})
/**
* $ gulp default
* description: Start the development environment
*/
gulp.task('default', function() {
gulp.run('server')
gulp.watch(['./app.js', './public/'], function() {
gulp.run('server')
})
})
// clean up if an error goes unhandled.
process.on('exit', function() {
if (node) node.kill()
})
:ここGulpfile.jsコードですこの厄介な警告メッセージを取り除くだけでなく、将来の私の開発プロセスの証明にこの問題を修正したいと思います。
ありがとうございました!
私は、最初のエラーがあったが、それは私のユーザー・エラーによるものでした。助けてくれてありがとう、私は非常に感謝し、あなたのソリューションは魅力のように動作します! – Corey