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

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

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

    <tfoot id='Tv9DA'></tfoot>

      我如何保證在我的應(yīng)用程序中一次性使用 gulp?

      How can I promise-ify a one-off usage of gulp in my application?(我如何保證在我的應(yīng)用程序中一次性使用 gulp?)

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

            <tbody id='nyIT4'></tbody>

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

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

        • <legend id='nyIT4'><style id='nyIT4'><dir id='nyIT4'><q id='nyIT4'></q></dir></style></legend>
            <tfoot id='nyIT4'></tfoot>

                本文介紹了我如何保證在我的應(yīng)用程序中一次性使用 gulp?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

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

                作為我正在編寫的一個(gè)小程序的一部分,我想使用 gulp 將大量文件轉(zhuǎn)換為 markdown.這不是獨(dú)立于程序的構(gòu)建步驟的一部分.這是程序的一部分.所以我沒有使用 gulpfile 來處理這個(gè)問題.

                As part of a small program I'm writing, I would like to use gulp to convert a large set of a files to markdown. This is not part of a build step separate from the program. It's a part of the program. So I'm not using a gulpfile to handle this.

                問題是,因?yàn)樗钱惒降模晕蚁胧褂靡粋€(gè) Promise,它會(huì)在 gulp 任務(wù)完成時(shí)提醒我.

                The problem is, since it's async, I want to use a promise which will alert me when the gulp task is finished.

                這樣的東西是理想的:

                io.convertSrc = function() {
                  var def = q.defer();
                
                  gulp.src(src + '/*.md')
                    .pipe(marked({}))
                    .pipe(gulp.dest(dist), function() {
                      def.resolve('We are done!');
                    });
                
                    return def.promise;
                }
                

                pipe 不接受回調(diào).我怎么能處理這個(gè)?感謝您的幫助,我對(duì) gulp 有點(diǎn)陌生.

                But pipe doesn't take a callback. How could I handle this? Thanks for your help, I'm somewhat new to gulp.

                推薦答案

                gulp 中的一切都是一個(gè)流,所以你可以只監(jiān)聽 enderror 事件.

                Everything in gulp is a stream, so you can just listen for the end and error events.

                io.convertSrc = function() {
                  var def = q.defer();
                  gulp.src(src + '/*.md')
                    .pipe(marked({}))
                    .pipe(gulp.dest(dist))
                    .on('end', function() {
                      def.resolve();
                    })
                    .on('error', def.reject);
                  return def.promise;
                }
                

                順便說一句,Q 1.0 不再被開發(fā)(除了一些修復(fù))并且將完全不兼容Q 2.0;我推薦 Bluebird 作為替代方案.

                As an aside, Q 1.0 is no longer developed (aside from a few fixes here and there) and will be wholly incompatible with Q 2.0; I'd recommend Bluebird as an alternative.

                還值得一提的是,NodeJS 0.12 及更高版本已內(nèi)置 ES6 承諾(不需要 --harmony 標(biāo)志),因此如果您不尋求向后兼容性,您可以使用它們來代替..

                Also worth mentioning that NodeJS 0.12 onwards has ES6 promises built into it (no --harmony flag necessary) so if you're not looking for backwards compatibility you can just use them instead..

                io.convertSrc = function() {
                  return new Promise(function(resolve, reject) {
                    gulp.src(src + '/*.md')
                      .pipe(marked({}))
                      .pipe(gulp.dest(dist))
                      .on('end', resolve)
                      .on('error', reject);
                  });
                };
                

                這篇關(guān)于我如何保證在我的應(yīng)用程序中一次性使用 gulp?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(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 類型而未加載樣式表)
                Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時(shí) Visual Studio 2015 崩潰)

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

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

                  • <tfoot id='pKchO'></tfoot>
                          <tbody id='pKchO'></tbody>
                          <bdo id='pKchO'></bdo><ul id='pKchO'></ul>
                          主站蜘蛛池模板: 日韩一区二区三区视频在线播放 | 91久久精品国产 | 日韩欧美一级 | 日韩视频在线一区 | 国产成人精品一区二区三区视频 | 一级a性色生活片久久毛片 午夜精品在线观看 | 欧美日韩久久精品 | 91视频国产一区 | 精品美女在线观看视频在线观看 | 久久久久久成人 | 日韩喷潮 | 国产精品三级 | 男女爱爱福利视频 | 天天看天天操 | av在线视 | av网站在线看 | 日本一区二区视频 | 欧美日韩一二区 | 欧美精品网站 | 国产精品日韩 | 国产成人综合在线 | 精品福利在线 | 亚洲福利在线观看 | 一区二区三区四区视频 | 91九色在线观看 | 日韩一区二区三区在线 | 色视频在线观看 | 伦理片97 | 欧美日韩亚洲二区 | 日韩欧美精品在线 | jlzzxxxx18hd护士| 国产精品日本一区二区不卡视频 | 久久久国产一区二区三区 | 日韩精品在线看 | 在线观看亚洲精品 | 综合久 | 伊人狼人影院 | 欧美在线a | 亚洲国产成人在线观看 | 天天视频一区二区三区 | 久久成人免费观看 |