久久久久久久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, 觀看, 改變的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                問(wèn)題描述

                限時(shí)送ChatGPT賬號(hào)..

                我無(wú)法理解這一點(diǎn).這應(yīng)該是每次修改監(jiān)視文件時(shí)執(zhí)行的 gulp 任務(wù).誰(shuí)能解釋為什么需要通過(guò) changed 插件來(lái)管道監(jiān)視的文件?

                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']); 
                }); 
                

                免責(zé)聲明:這不是我的代碼.只是想了解發(fā)生了什么,以便創(chuàng)建我自己的自定義監(jiān)視任務(wù).

                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的區(qū)別 似乎引起了很多混亂,所以這是我解開(kāi)混亂的嘗試:

                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 本身 的一部分,而不是插件.這很重要,因?yàn)檫@意味著與其他兩個(gè)不同,它不會(huì)傳遞給 gulp 流的 pipe() 函數(shù).

                相反,它通常直接從 gulp 任務(wù)內(nèi)部調(diào)用:

                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()用來(lái)監(jiān)聽(tīng).css文件的變化.只要 gulp.watch() 正在運(yùn)行對(duì) .css 文件的任何更改,就會(huì)自動(dòng)執(zhí)行 build-css 任務(wù).

                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.

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

                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.

                這個(gè) 插件 被編寫(xiě)為在 gulp 流中充當(dāng)過(guò)濾器階段.其目的是從流中刪除自上次構(gòu)建以來(lái)未更改的所有文件.它通過(guò)將源目錄中的文件與目標(biāo)目錄中的結(jié)果文件進(jìn)行比較來(lái)做到這一點(diǎn):

                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 任務(wù)仍然為 .css 文件的每次更改調(diào)用,并且所有 .css 文件都被讀取然而,只有那些實(shí)際更改過(guò)的文件現(xiàn)在到達(dá)昂貴的 doSomethingHere() 階段.其余的被 gulp-changed 過(guò)濾掉.

                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 的速度,即使您不關(guān)注文件更改.您可以在命令行上顯式調(diào)用 gulp build-css,并且只有自上次調(diào)用 build-css 后發(fā)生更改的文件才會(huì)被重建.

                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.

                這個(gè) 插件 是對(duì)內(nèi)置 gulp 的改進(jìn)嘗試.watch().而 gulp.watch() 使用 gaze 監(jiān)聽(tīng)文件變化,gulp-watch 使用 chokidar 一般認(rèn)為是兩者中比較成熟的一個(gè).

                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 來(lái)達(dá)到與使用 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'));
                 }); 
                

                這再次監(jiān)視所有 .css 文件的更改.但是這一次,每當(dāng) .css 文件被更改時(shí),該文件(以及 only 該文件)會(huì)再次被讀入并重新發(fā)送到它通過(guò) doSomethingHere 的流中() 在前往目標(biāo)目錄的途中.

                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.

                請(qǐng)注意,此比較以相當(dāng)寬泛的筆觸描繪了所有三個(gè)替代方案,并遺漏了某些細(xì)節(jié)和功能(例如,我沒(méi)有討論您可以傳遞給這兩個(gè)的回調(diào)函數(shù) gulp.watch()gulp-watch),但我認(rèn)為這應(yīng)該足以了解這三者之間的主要區(qū)別.

                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.

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

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

                相關(guān)文檔推薦

                Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運(yùn)算符上的意外令牌)
                Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標(biāo)志傳遞給 Gulp 以使其以不同的方式運(yùn)行任務(wù)?)
                Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                How to run Gulp tasks sequentially one after the other(如何一個(gè)接一個(gè)地依次運(yùn)行 Gulp 任務(wù))
                Stylesheet not loaded because of MIME-type(由于 MIME 類(lèi)型而未加載樣式表)
                Visual Studio 2015 crashes when opening Javascript files(打開(kāi) Javascript 文件時(shí) 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 | 国产一区 | 久久免费精品 | 日韩日韩日韩日韩日韩日韩日韩 | 日韩精品一区二区三区中文在线 | 欧美性受 | 国产精品久久久久久婷婷天堂 | 日本不卡一区二区三区 | 欧美日韩国产免费 | 亚洲精品久久久一区二区三区 | 亚洲欧美国产毛片在线 | 午夜免费av | 男人天堂网址 | 久久久久亚洲 | 国产欧美精品一区二区 | 成人午夜电影在线观看 | 国产精品一区二区三区在线 | 中文久久 | 日本精品一区二区三区在线观看视频 | 国产精品久久久久久久久免费相片 | 成人激情免费视频 | 久久精品一区二区三区四区 | 91精品国产综合久久精品 | 久久精品国产免费 | 免费在线观看毛片 | 全免费a级毛片免费看视频免 | 九九九久久国产免费 | 国产免费观看久久黄av片涩av | 色婷婷综合在线观看 | 日韩一区二区三区在线 | 国产成人精品一区二区三区视频 | 九七午夜剧场福利写真 | 亚洲一区| 精品在线一区 | 欧美一级视频 | 日韩欧美高清dvd碟片 | 一区二区三区四区不卡 | 国外成人在线视频 | 欧美视频一区二区三区 | 在线电影日韩 | 国产午夜精品一区二区三区在线观看 |