<legend id='CZp35'><style id='CZp35'><dir id='CZp35'><q id='CZp35'></q></dir></style></legend>

        <bdo id='CZp35'></bdo><ul id='CZp35'></ul>

      <small id='CZp35'></small><noframes id='CZp35'>

      <i id='CZp35'><tr id='CZp35'><dt id='CZp35'><q id='CZp35'><span id='CZp35'><b id='CZp35'><form id='CZp35'><ins id='CZp35'></ins><ul id='CZp35'></ul><sub id='CZp35'></sub></form><legend id='CZp35'></legend><bdo id='CZp35'><pre id='CZp35'><center id='CZp35'></center></pre></bdo></b><th id='CZp35'></th></span></q></dt></tr></i><div id='CZp35'><tfoot id='CZp35'></tfoot><dl id='CZp35'><fieldset id='CZp35'></fieldset></dl></div>
    1. <tfoot id='CZp35'></tfoot>

      Gulp.js,保存文件时监视任务运行两次

      时间:2023-05-29
      <i id='AFgdL'><tr id='AFgdL'><dt id='AFgdL'><q id='AFgdL'><span id='AFgdL'><b id='AFgdL'><form id='AFgdL'><ins id='AFgdL'></ins><ul id='AFgdL'></ul><sub id='AFgdL'></sub></form><legend id='AFgdL'></legend><bdo id='AFgdL'><pre id='AFgdL'><center id='AFgdL'></center></pre></bdo></b><th id='AFgdL'></th></span></q></dt></tr></i><div id='AFgdL'><tfoot id='AFgdL'></tfoot><dl id='AFgdL'><fieldset id='AFgdL'></fieldset></dl></div>

          <bdo id='AFgdL'></bdo><ul id='AFgdL'></ul>
        • <tfoot id='AFgdL'></tfoot>

            <legend id='AFgdL'><style id='AFgdL'><dir id='AFgdL'><q id='AFgdL'></q></dir></style></legend>

              <small id='AFgdL'></small><noframes id='AFgdL'>

                <tbody id='AFgdL'></tbody>

              • 本文介绍了Gulp.js,保存文件时监视任务运行两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                鉴于我的 gulpfile.js 中的以下代码,每次我保存或更改文件时,任务都会运行两次而不是一次,这是为什么呢?我只想让它运行一次.

                Given the following piece of code from my gulpfile.js, everytime I save or change a file, the task runs twice instead of one single time, why is that? I just want it to run one time.

                var gulp = require('gulp');
                
                gulp.task('default', function() {
                
                  gulp.watch('server/**/*.js', function(){
                    console.log('This runs twice everytime I change/save a javascript file located at server/**/*.js');
                  }); 
                
                });
                

                我对 grunt 和名为 grunt-contrib-watch 的插件也有同样的体验.

                I have also experienced the same with grunt and the plugin called grunt-contrib-watch.

                推荐答案

                似乎这个问题的答案是使用的编辑器 Coda 2 的一个功能.根据这里的一些评论和多个编辑器的测试,似乎 Coda 2 保存了一个临时文件或类似文件,这会导致 gulp watch 函数运行两次.

                Seems like the answer to this question is a feature of the editor that was used, Coda 2. Based on some of the comments here and testing with multiple editors, it seems like Coda 2 saves a temporary file or similar and that causes the gulp watch function to be run twice.

                我在使用 Coda 2 时没有找到可行的解决方案,最终切换到 Sublime Text 3.

                I have not found a viable solution to this when using Coda 2, ended up with switching to Sublime Text 3.

                这篇关于Gulp.js,保存文件时监视任务运行两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何强制 gulp 调用同步运行? 下一篇:从一个 gulpfile.js 从另一个 gulpfile.js 运行 gulp 任务

                相关文章

                最新文章

                • <bdo id='JDbBI'></bdo><ul id='JDbBI'></ul>

                1. <tfoot id='JDbBI'></tfoot>

                  <legend id='JDbBI'><style id='JDbBI'><dir id='JDbBI'><q id='JDbBI'></q></dir></style></legend>

                  <small id='JDbBI'></small><noframes id='JDbBI'>

                2. <i id='JDbBI'><tr id='JDbBI'><dt id='JDbBI'><q id='JDbBI'><span id='JDbBI'><b id='JDbBI'><form id='JDbBI'><ins id='JDbBI'></ins><ul id='JDbBI'></ul><sub id='JDbBI'></sub></form><legend id='JDbBI'></legend><bdo id='JDbBI'><pre id='JDbBI'><center id='JDbBI'></center></pre></bdo></b><th id='JDbBI'></th></span></q></dt></tr></i><div id='JDbBI'><tfoot id='JDbBI'></tfoot><dl id='JDbBI'><fieldset id='JDbBI'></fieldset></dl></div>