久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='uvhDM'></tfoot>

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

      <bdo id='uvhDM'></bdo><ul id='uvhDM'></ul>
    <i id='uvhDM'><tr id='uvhDM'><dt id='uvhDM'><q id='uvhDM'><span id='uvhDM'><b id='uvhDM'><form id='uvhDM'><ins id='uvhDM'></ins><ul id='uvhDM'></ul><sub id='uvhDM'></sub></form><legend id='uvhDM'></legend><bdo id='uvhDM'><pre id='uvhDM'><center id='uvhDM'></center></pre></bdo></b><th id='uvhDM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='uvhDM'><tfoot id='uvhDM'></tfoot><dl id='uvhDM'><fieldset id='uvhDM'></fieldset></dl></div>

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

    1. javascript, gulp, 觀看, 改變

      javascript, gulp, watch, changed(javascript, gulp, 觀看, 改變)

      <small id='6KjhU'></small><noframes id='6KjhU'>

        <bdo id='6KjhU'></bdo><ul id='6KjhU'></ul>

              <tbody id='6KjhU'></tbody>

            • <tfoot id='6KjhU'></tfoot>

                <legend id='6KjhU'><style id='6KjhU'><dir id='6KjhU'><q id='6KjhU'></q></dir></style></legend>
                <i id='6KjhU'><tr id='6KjhU'><dt id='6KjhU'><q id='6KjhU'><span id='6KjhU'><b id='6KjhU'><form id='6KjhU'><ins id='6KjhU'></ins><ul id='6KjhU'></ul><sub id='6KjhU'></sub></form><legend id='6KjhU'></legend><bdo id='6KjhU'><pre id='6KjhU'><center id='6KjhU'></center></pre></bdo></b><th id='6KjhU'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6KjhU'><tfoot id='6KjhU'></tfoot><dl id='6KjhU'><fieldset id='6KjhU'></fieldset></dl></div>
              • 本文介紹了javascript, gulp, 觀看, 改變的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我無法理解這一點.這應該是每次修改監視文件時執行的 gulp 任務.誰能解釋為什么需要通過 changed 插件來管道監視的文件?

                I cannot get my head around this. This is supposed to be a gulp task that is executed every time a watched file is modified. Can anyone explain why it is required to pipe the watched files through the changed plugin?

                gulp.task('build-css', function () {
                  return gulp.src(paths.css)
                  .pipe(changed(paths.output, {extension: '.css'}))
                  .pipe(gulp.dest(paths.output));
                });
                
                gulp.task('watch', ['serve'], function() { 
                  gulp.watch(paths.css, ['build-css']); 
                }); 
                

                免責聲明:這不是我的代碼.只是想了解發生了什么,以便創建我自己的自定義監視任務.

                Disclaimer: this is not my code. Just trying to understand what is going on, in order to create my own custom watch task.

                推薦答案

                gulp.watch()gulp-changedgulp-watch的區別 似乎引起了很多混亂,所以這是我解開混亂的嘗試:

                The difference between gulp.watch(), gulp-changed and gulp-watch seems to cause a lot of confusion, so here's my attempt at untangling the mess:

                這是 gulp 本身 的一部分,而不是插件.這很重要,因為這意味著與其他兩個不同,它不會傳遞給 gulp 流的 pipe() 函數.

                相反,它通常直接從 gulp 任務內部調用:

                Instead it is usually called directly from inside a gulp task:

                 gulp.task('build-css', function() { 
                    return gulp.src('src/**/*.css')
                      .pipe(doSomethingHere())
                      .pipe(gulp.dest('dist/css'));
                 }); 
                
                 gulp.task('watch', function() { 
                    gulp.watch('src/**/*.css', ['build-css']); 
                 }); 
                

                上面的gulp.watch()用來監聽.css文件的變化.只要 gulp.watch() 正在運行對 .css 文件的任何更改,就會自動執行 build-css 任務.

                In the above gulp.watch() is used to listen for changes in .css files. As long as gulp.watch() is running any change to a .css file automatically results in the execution of the build-css task.

                這就是麻煩的開始.請注意沒有關于哪些文件發生更改的信息傳遞給 build-css?這意味著即使您僅更改單個 .css 文件 all 您的 .css 文件也將通過 doSomethingHere()再次.build-css 任務不知道它們中的哪一個發生了變化.只要您只有一手文件,這可能沒問題,但隨著文件數量的增加,您的構建速度會變慢.

                This is where the trouble starts. Notice how no information about which files where changed is passed to build-css? That means even if you change just a single .css file all of your .css files will pass through doSomethingHere() again. The build-css task has no clue which of them changed. This may be fine as long as you have only a hand full of files, but can slow down your build as the number of files grows.

                這就是 gulp-changed 的用武之地.

                That's where gulp-changed comes in.

                這個 插件 被編寫為在 gulp 流中充當過濾器階段.其目的是從流中刪除自上次構建以來未更改的所有文件.它通過將源目錄中的文件與目標目錄中的結果文件進行比較來做到這一點:

                This plugin was written to act as a filter stage in a gulp stream. Its purpose is to remove all those files from a stream that haven't changed since the last build. It does this by comparing the files in the source directory with the resulting files in the destination directory:

                 gulp.task('build-css', function() { 
                    return gulp.src('src/**/*.css')
                      .pipe(changed('dist/css'))  //compare with files in dist/css
                      .pipe(doSomethingHere())
                      .pipe(gulp.dest('dist/css'));
                 }); 
                
                 gulp.task('watch', function() { 
                    gulp.watch('src/**/*.css', ['build-css']); 
                 }); 
                

                在上面的 build-css 任務仍然為 .css 文件的每次更改調用,并且所有 .css 文件都被讀取然而,只有那些實際更改過的文件現在到達昂貴的 doSomethingHere() 階段.其余的被 gulp-changed 過濾掉.

                In the above the build-css task is still called for every change of a .css file and all .css files are read in. However only those files that were actually changed now reach the expensive doSomethingHere() stage. The rest is filtered out by gulp-changed.

                這種方法的好處是可以加快 build-css 的速度,即使您不關注文件更改.您可以在命令行上顯式調用 gulp build-css,并且只有自上次調用 build-css 后發生更改的文件才會被重建.

                This approach has the benefit of speeding up build-css even if you're not watching for file changes. You can explicitly invoke gulp build-css on the command-line and only those files that have changed since the last invocation of build-css will be rebuilt.

                這個 插件 是對內置 gulp 的改進嘗試.watch().而 gulp.watch() 使用 gaze 監聽文件變化,gulp-watch 使用 chokidar 一般認為是兩者中比較成熟的一個.

                This plugin is an attempt to improve on the built-in gulp.watch(). While gulp.watch() uses gaze to listen for file changes, gulp-watch uses chokidar which is generally considered to be the more mature of the two.

                你可以使用 gulp-watch 來達到與使用 gulp.watch()gulp-changed 組合的效果:

                You can use gulp-watch to achieve the same effect as using gulp.watch() and gulp-changed in combination:

                 gulp.task('watch-css', function() { 
                    return gulp.src('src/**/*.css')
                      .pipe(watch('src/**/*.css'))
                      .pipe(doSomethingHere())
                      .pipe(gulp.dest('dist/css'));
                 }); 
                

                這再次監視所有 .css 文件的更改.但是這一次,每當 .css 文件被更改時,該文件(以及 only 該文件)會再次被讀入并重新發送到它通過 doSomethingHere 的流中() 在前往目標目錄的途中.

                This again watches all .css files for changes. But this time whenever a .css file is changed, that file (and only that file) is read in again and reemitted to the stream where it passes through doSomethingHere() on its way to the destination directory.

                請注意,此比較以相當寬泛的筆觸描繪了所有三個替代方案,并遺漏了某些細節和功能(例如,我沒有討論您可以傳遞給這兩個的回調函數 gulp.watch()gulp-watch),但我認為這應該足以了解這三者之間的主要區別.

                Note that this comparison paints all three of the alternatives in rather broad strokes and leaves out certain details and features (e.g. I haven't talked about the callback functions that you can pass to both gulp.watch() and gulp-watch), but I think this should be enough to get the major differences between the three across.

                這篇關于javascript, gulp, 觀看, 改變的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運算符上的意外令牌)
                Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標志傳遞給 Gulp 以使其以不同的方式運行任務?)
                Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                How to run Gulp tasks sequentially one after the other(如何一個接一個地依次運行 Gulp 任務)
                Stylesheet not loaded because of MIME-type(由于 MIME 類型而未加載樣式表)
                Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時 Visual Studio 2015 崩潰)
                    <tbody id='0R9Yv'></tbody>

                  <legend id='0R9Yv'><style id='0R9Yv'><dir id='0R9Yv'><q id='0R9Yv'></q></dir></style></legend>

                  <tfoot id='0R9Yv'></tfoot>
                      <bdo id='0R9Yv'></bdo><ul id='0R9Yv'></ul>

                          <small id='0R9Yv'></small><noframes id='0R9Yv'>

                        • <i id='0R9Yv'><tr id='0R9Yv'><dt id='0R9Yv'><q id='0R9Yv'><span id='0R9Yv'><b id='0R9Yv'><form id='0R9Yv'><ins id='0R9Yv'></ins><ul id='0R9Yv'></ul><sub id='0R9Yv'></sub></form><legend id='0R9Yv'></legend><bdo id='0R9Yv'><pre id='0R9Yv'><center id='0R9Yv'></center></pre></bdo></b><th id='0R9Yv'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0R9Yv'><tfoot id='0R9Yv'></tfoot><dl id='0R9Yv'><fieldset id='0R9Yv'></fieldset></dl></div>
                          主站蜘蛛池模板: 韩日av片| 国产黄色在线 | cao在线| 精品久久久久久亚洲综合网站 | 国产黄色精品在线观看 | 夜夜草视频 | 久久免费视频在线 | 欧美性久久 | 久久久精品影院 | 国产一区精品 | 欧美激情视频一区二区三区免费 | 天天操人人干 | 久久亚洲精品视频 | 成人免费一区二区三区视频网站 | 在线观看成人 | 中文字幕av高清 | 欧美乱大交xxxxx另类电影 | 久久精品亚洲欧美日韩精品中文字幕 | 午夜看片网站 | 欧美色图另类 | 精品在线一区二区 | 亚洲国产成人精品女人 | 国产一区二区三区在线看 | 成人精品一区二区三区四区 | 欧美国产日韩在线观看 | 国内精品免费久久久久软件老师 | 免费观看黄| 99视频在线看 | 久久久久亚洲精品 | 国产日产精品一区二区三区四区 | 懂色中文一区二区三区在线视频 | 北条麻妃一区二区三区在线视频 | 日韩av成人在线 | 黄色免费网站在线看 | 综合五月 | 精品乱码一区二区 | 一区二区三区中文字幕 | 国产免费一区二区三区 | 亚洲国产成人精品久久久国产成人一区 | 亚洲视频在线一区 | 欧美一区二区三区四区五区无卡码 |