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

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

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

      1. 如何編寫一個簡單的 gulp 管道函數?

        How can I write a simple gulp pipe function?(如何編寫一個簡單的 gulp 管道函數?)

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

            <tbody id='V3dJd'></tbody>
            <bdo id='V3dJd'></bdo><ul id='V3dJd'></ul>
            <legend id='V3dJd'><style id='V3dJd'><dir id='V3dJd'><q id='V3dJd'></q></dir></style></legend>
            <tfoot id='V3dJd'></tfoot>

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

                1. 本文介紹了如何編寫一個簡單的 gulp 管道函數?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我已經嘗試了一天來編寫兩個管道函數,一個編譯更少的文件,另一個連接這些文件.我想學習如何為更復雜的插件編寫轉換流/管道.

                  I've been trying for a day to write two pipe functions, one that compiles less files and another one that concats these files. I want to learn how to write transform streams/pipes for more complex plugins.

                  所以我想知道如何從另一個管道讀取數據,以及如何更改該數據并將其發送到下一個管道.這是我目前所擁有的:

                  So I want to know how to read data from another pipe, and how to alter that data and send it to the next pipe. This is what I have so far:

                   gulp.src(sources)
                     .pipe(through.obj(function (chunk, enc, cb) {
                  
                       var t = this;
                       // console.log("chunk", chunk.path);
                       fs.readFile(chunk.path, enc, function (err,data) {
                         if (err) { cb(err); }
                  
                         less.render(data, {
                           filename : chunk.path,
                           sourceMap : {
                             sourceMapRootpath : true
                           }
                         })
                         .then(function (outputCss) {
                            // console.log("less result",outputCss);
                            t.push(chunk);// or this.push(outputCss) same result
                            cb();
                         });
                  
                       });
                  
                     }))
                     .pipe(through.obj(function (chunk, enc, cb) {
                       console.log("chunk", chunk.path); // not event getting called.
                       cb();
                     }))
                  

                  我無法為第二個管道中的每個文件獲取 outputCSS.如何發送?

                  I can't get the outputCSS for each file in the second pipe. How can I send it?

                  推薦答案

                  好了,這里你不需要使用 fs,你已經得到了文件流(這里是你的 chunk).

                  Well, you don't need to use fs here, you already got the stream of file (here your chunk).

                  另一點,您沒有將文件發送回管道,所以我想這就是為什么在您的第二個文件上沒有調用任何內容的原因.

                  Another point, you're not sending back to the pipe the files, so I guess that's why nothing is called on your second one.

                  const through = require('through2')
                  
                  gulp.src(sources)
                    .pipe(through.obj((chunk, enc, cb) => {
                      console.log('chunk', chunk.path) // this should log now
                      cb(null, chunk)
                    }))
                  

                  在 ES2015 中:

                  In ES2015:

                  import through from 'through2'
                  
                  gulp.src(sources)
                    .pipe(through.obj((chunk, enc, cb) => cb(null, chunk)))
                  

                  對于你的具體例子:

                  .pipe(through.obj((file, enc, cb) => {
                    less.render(file.contents, { filename: file.path, ... }) // add other options
                      .then((res) => {
                        file.contents = new Buffer(res.css)
                        cb(null, file)
                      })
                  }))
                  

                  這仍然很基本,我不檢查錯誤,如果它不是流等等,但這應該會給你一些關于你錯過了什么的提示.

                  This is still pretty basic, I don't check for errors, if it's not a stream and so on, but this should give you some hint on what you've missed.

                  這篇關于如何編寫一個簡單的 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='sPvE8'></tbody>
                    <legend id='sPvE8'><style id='sPvE8'><dir id='sPvE8'><q id='sPvE8'></q></dir></style></legend>

                    • <small id='sPvE8'></small><noframes id='sPvE8'>

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

                          <tfoot id='sPvE8'></tfoot>
                            <bdo id='sPvE8'></bdo><ul id='sPvE8'></ul>
                            主站蜘蛛池模板: 亚州精品天堂中文字幕 | 一级片网站视频 | 亚洲精品中文字幕在线 | 成人av网站在线观看 | 国产精品国产 | 成人国产精品免费观看视频 | 国产片侵犯亲女视频播放 | 视频一区二区三区中文字幕 | 国产ts人妖另类 | 精品亚洲一区二区三区 | 欧美精品久久久 | 亚洲精品久久久久中文字幕欢迎你 | 国产日韩精品一区二区 | 久久99精品国产99久久6男男 | 欧美精品一区二区在线观看 | 国产精品黄色 | 美国黄色毛片 | 激情a| 欧美一级在线 | 亚洲精品www. | 精品亚洲一区二区三区四区五区高 | 91资源在线 | www,黄色,com | 国产精品v | 欧美日韩高清在线一区 | 亚洲一区二区三区四区五区中文 | 亚洲欧美在线免费观看 | 精品国产乱码久久久久久图片 | 亚洲视频二区 | 午夜视频在线 | 一级高清视频 | 国产一级片一区二区三区 | 91精品国产91久久久久游泳池 | 日韩综合一区 | 黄在线 | 免费毛片网站 | 国产精品免费在线 | 三级成人片 | 五月婷婷导航 | 久久视频精品 | 日本欧美大片 |