Dosyaları yudumda nasıl izleyebilirim? [çiftleme]
Aug 15 2020
Web geliştirme konusunda eski bir ders alıyorum ve yudumla ilgili sıkışıp kaldım. Anlamaya çalıştığım şey, gulp watch kullanarak dosyaların nasıl izleneceği. Komutumda "gulp watch" a her bastığımda bir hata mesajı alıyorum. Bunu nasıl düzelteceğini bilen var mı? İşte gulpfile.js kodum:
<pre>
var gulp = require('gulp'),
watch = require('gulp-watch');
gulp.task('default', function() {
console.log("This is a gulp task");
});
gulp.task('html', function() {
console.log("This is your HTML");
});
gulp.task('styles', function() {
console.log("This is for your css/sass/postcss`enter code here`");
});
gulp.task('watch', function() {
watch('./app/index.html', function() {
gulp.start('html');
});
watch('./app/assets/styles/**/*.css', function() {
gulp.start('styles');
});
});
</pre>
İşte hata mesajı:
(node:7812) UnhandledPromiseRejectionWarning: TypeError: gulp.start is not a function
(node:7812) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:7812) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Yanıtlar
nunop Aug 17 2020 at 21:30
Yana gulp.start
sen Gulp bu sürümünü kullanıyorsanız v4 zamandan beri kullanılmadığından ve denemek isteyebilirsiniz gulp.seriesyerine:
gulp.task('watch', gulp.series('styles', 'html', function(done) {
gulp.watch('./app/assets/styles/**/*.css', gulp.series('styles'));
gulp.watch('./app/index.html', gulp.series('html'));
done();
}));
Nicole Kidman, Michael Keaton ve Val Kilmer'in Batman Olarak Paylaştığı Bu 1 Çekici Özelliğe Bayıldı
Donovan, Şarkılarından 1'ini The Beatles'ın "Lucy in the Sky with Diamonds" şarkısıyla karşılaştırdı
Tom Girardi Dolandırıcılık Suçlamalarından Yargılanma Yetkisinin Belirlenmesi İçin Duruşmaya Katıldı
Charly Reynolds Yakın Zamandaki Vokal Kord Ameliyatını Açıkladı: 'Şarkı Söylemekte Sorun Yaşıyordum'