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

<tfoot id='nnvTr'></tfoot>

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

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

    2. 將 Gulp glob 鏈接到瀏覽器化轉換

      Chain Gulp glob to browserify transform(將 Gulp glob 鏈接到瀏覽器化轉換)

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

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

            <legend id='nL7Tc'><style id='nL7Tc'><dir id='nL7Tc'><q id='nL7Tc'></q></dir></style></legend>
              • <i id='nL7Tc'><tr id='nL7Tc'><dt id='nL7Tc'><q id='nL7Tc'><span id='nL7Tc'><b id='nL7Tc'><form id='nL7Tc'><ins id='nL7Tc'></ins><ul id='nL7Tc'></ul><sub id='nL7Tc'></sub></form><legend id='nL7Tc'></legend><bdo id='nL7Tc'><pre id='nL7Tc'><center id='nL7Tc'></center></pre></bdo></b><th id='nL7Tc'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='nL7Tc'><tfoot id='nL7Tc'></tfoot><dl id='nL7Tc'><fieldset id='nL7Tc'></fieldset></dl></div>
                <tfoot id='nL7Tc'></tfoot>
                  <tbody id='nL7Tc'></tbody>
                本文介紹了將 Gulp glob 鏈接到瀏覽器化轉換的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我有一個項目,其中包含幾個相對不相交的頁面,每個頁面都包含自己的入口點腳本.這些腳本需要其他一些使用commonjs語法的腳本,需要經過6to5轉換并被browserify打包.

                I have a project with a few relatively disjoint pages, each including their own entry point script. These scripts require a number of others using commonjs syntax, and need to be transformed by 6to5 and bundled by browserify.

                我想設置一個 gulp 任務來捕獲所有匹配模式的文件并將它們傳遞給捆綁程序,但我不確定如何將文件從 gulp.src 傳遞到瀏覽(文件名).

                I would like to set up a gulp task that captures all the files matching a pattern and passes them on to the bundler, but I'm not sure how to pass files from gulp.src to browserify(filename).

                我的 gulpfile 看起來像:

                My gulpfile looks like:

                var gulp = require("gulp");
                var browserify = require("browserify");
                var to5browserify = require("6to5-browserify");
                var source = require("vinyl-source-stream");
                
                var BUNDLES = [
                    "build.js",
                    "export.js",
                    "main.js"
                ];
                
                gulp.task("bundle", function () {
                    /* Old version, using glob:
                    return gulp.src("src/** /*.js")
                        .pipe(sixto5())
                        .pipe(gulp.dest("dist"));
                    */
                
                    // New version, using array:
                    return BUNDLES.map(function (bundle) {
                        return browserify("./src/" + bundle, {debug: true})
                            .transform(to5browserify)
                            .bundle()
                            .pipe(source(bundle))
                            .pipe(gulp.dest("./dist"));
                    });
                });
                
                gulp.task("scripts", ["bundle"]);
                
                gulp.task("html", function () {
                    return gulp.src("src/**/*.html")
                        .pipe(gulp.dest("dist"));
                });
                
                gulp.task("styles", function () {
                    return gulp.src("src/**/*.css")
                        .pipe(gulp.dest("dist"));
                });
                
                gulp.task("default", ["scripts", "html", "styles"]);
                

                這似乎可行,但不可維護:我將很快添加更多腳本,并且不想每次都將它們添加到數組中.

                This seems to work, but isn't maintainable: I'll be adding more scripts relatively soon, and don't want to add them to the array every time.

                我嘗試在 browserify 調用中使用 gulp.src(glob).pipe 并在調用后使用管道 (此處顯示)和 gulp.src(glob).map(方法不存在).

                I've tried using gulp.src(glob).pipe within the browserify call and piping after calling (shown here), and gulp.src(glob).map (method doesn't exist).

                如何將 gulp.src 與 browserify 等基于名稱的轉換器鏈接起來?

                How can you chain gulp.src with a name-based transformer like browserify?

                推薦答案

                使用through2制作一次性的自定義插件流,可以完成所有繁瑣的工作.

                Use through2 to make a one-off custom plugin stream that does all of the dirty work.

                不幸的是 vinyl-transformvinyl-source-stream 以及隨之而來的解決方案缺陷,所以我們必須去定制一些東西.

                Unfortanately vinyl-transform and vinyl-source-stream and the solutions that go along with those have flaws so we have to go for something custom.

                var gulp = require('gulp');
                var through = require('through2');
                var browserify = require('browserify');
                
                gulp.task('bundle', function() {
                    var browserified = function() {
                        return through.obj(function(chunk, enc, callback) {
                            if(chunk.isBuffer()) {
                                var b = browserify(chunk.path);
                                    // Any custom browserify stuff should go here
                                    //.transform(to5browserify);
                
                                chunk.contents = b.bundle();
                
                                this.push(chunk);
                
                            }
                            callback();
                        });
                    };
                
                    return gulp.src(['./src/**/*.js'])
                        .pipe(browserified())
                        .pipe(gulp.dest('dest'));
                });
                

                這篇關于將 Gulp glob 鏈接到瀏覽器化轉換的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='4Muxb'></tbody>
                      <tfoot id='4Muxb'></tfoot>
                    • <legend id='4Muxb'><style id='4Muxb'><dir id='4Muxb'><q id='4Muxb'></q></dir></style></legend>

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

                          <small id='4Muxb'></small><noframes id='4Muxb'>

                        • 主站蜘蛛池模板: 国产精品国产三级国产aⅴ中文 | 日本超碰 | 日韩av一区二区在线观看 | 日本三级在线 | 国产在线精品一区二区三区 | 亚洲综合无码一区二区 | 中文字幕在线视频免费视频 | 亚洲精品不卡 | 少妇无套高潮一二三区 | 99久久精品国产一区二区三区 | 看羞羞视频 | 欧美第一页 | 91精品国产91久久久久久丝袜 | 91久久国产综合久久 | 中文字幕在线人 | www.黄色网| 成人免费淫片aa视频免费 | 国产一级片免费在线观看 | 一区二区日韩 | 天天草天天射 | 美女中文字幕视频 | 天天干天天色 | 亚洲国产乱码 | 韩日在线视频 | 精品日韩一区 | 91久久久久| 精品欧美一区二区久久久伦 | 亚洲精品v日韩精品 | 欧美性视频在线播放 | 国产精品69毛片高清亚洲 | 欧美综合久久 | 久久亚洲国产 | 色视频免费 | 国产成人精品综合 | 中文字幕观看 | 日本久久精品视频 | 国产一级影片 | 亚洲97 | 中文字幕一二三区 | 99热精品在线观看 | 国产精品美女久久久久久不卡 |