pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<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="77jfhv7" 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="5fllhll" 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="bxvntxz" id='4Muxb'><tfoot id='4Muxb'></tfoot><dl id='4Muxb'><fieldset id='4Muxb'></fieldset></dl></div>

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

                        • 主站蜘蛛池模板: 外观设计_设备外观设计_外观设计公司_产品外观设计_机械设备外观设计_东莞工业设计公司-意品深蓝 | 玻纤土工格栅_钢塑格栅_PP焊接_单双向塑料土工格栅_复合防裂布厂家_山东大庚工程材料科技有限公司 | 集菌仪_智能集菌仪_全封闭集菌仪_无菌检查集菌仪厂家-那艾 | 智能电表|预付费ic卡水电表|nb智能无线远传载波电表-福建百悦信息科技有限公司 | 工业铝型材生产厂家_铝合金型材配件批发精加工定制厂商 - 上海岐易铝业 | 氧化锆纤维_1800度高温退火炉_1800度高温烧结炉-南京理工宇龙新材料股份有限公司 | 太空舱_民宿太空舱厂家_移动房屋太空舱价格-豪品建筑 | 仿真茅草_人造茅草瓦价格_仿真茅草厂家_仿真茅草供应-深圳市科佰工贸有限公司 | TPM咨询,精益生产管理,5S,6S现场管理培训_华谋咨询公司 | 蔡司三坐标-影像测量机-3D扫描仪-蔡司显微镜-扫描电镜-工业CT-ZEISS授权代理商三本工业测量 | 京港视通报道-质量走进大江南北-京港视通传媒[北京]有限公司 | 潍坊大集网-潍坊信息港-潍坊信息网 | 上海瑶恒实业有限公司|消防泵泵|离心泵|官网| 玉米深加工设备-玉米深加工机械-新型玉米工机械生产厂家-河南粮院机械制造有限公司 | 色油机-色母机-失重|称重式混料机-称重机-米重机-拌料机-[东莞同锐机械]精密计量科技制造商 | 冷柜风机-冰柜电机-罩极电机-外转子风机-EC直流电机厂家-杭州金久电器有限公司 | 帽子厂家_帽子工厂_帽子定做_义乌帽厂_帽厂_制帽厂_帽子厂_浙江高普制帽厂 | 旋振筛|圆形摇摆筛|直线振动筛|滚筒筛|压榨机|河南天众机械设备有限公司 | 间苯二酚,间苯二酚厂家-淄博双和化工 | 超声波清洗机_大型超声波清洗机_工业超声波清洗设备-洁盟清洗设备 | 膏剂灌装旋盖机-眼药水灌装生产线-西林瓶粉剂分装机-南通博琅机械科技 | 珠海网站建设_响应网站建设_珠海建站公司_珠海网站设计与制作_珠海网讯互联 | 一体化污水处理设备_生活污水处理设备_全自动加药装置厂家-明基环保 | 锂电池生产厂家-电动自行车航模无人机锂电池定制-世豹新能源 | 日本SMC气缸接头-速度控制阀-日本三菱伺服电机-苏州禾力自动化科技有限公司 | 上海办公室装修,办公楼装修设计,办公空间设计,企业展厅设计_写艺装饰公司 | 液晶拼接屏厂家_拼接屏品牌_拼接屏价格_监控大屏—北京维康 | 镀锌方管,无缝方管,伸缩套管,方矩管_山东重鑫致胜金属制品有限公司 | MES系统-WMS系统-MES定制开发-制造执行MES解决方案-罗浮云计算 | ASA膜,ASA共挤料,篷布色母料-青岛未来化学有限公司 | 质构仪_鱼糜弹性仪-上海腾拔仪器科技有限公司 | 防渗土工膜|污水处理防渗膜|垃圾填埋场防渗膜-泰安佳路通工程材料有限公司 | 深圳激光打标机_激光打标机_激光焊接机_激光切割机_同体激光打标机-深圳市创想激光科技有限公司 深圳快餐店设计-餐饮设计公司-餐饮空间品牌全案设计-深圳市勤蜂装饰工程 | 塑钢件_塑钢门窗配件_塑钢配件厂家-文安县启泰金属制品有限公司 深圳南财多媒体有限公司介绍 | 全自动端子机|刺破式端子压接机|全自动双头沾锡机|全自动插胶壳端子机-东莞市傅氏兄弟机械设备有限公司 | 贴片电感_贴片功率电感_贴片绕线电感_深圳市百斯特电子有限公司 贴片电容代理-三星电容-村田电容-风华电容-国巨电容-深圳市昂洋科技有限公司 | CNC机加工-数控加工-精密零件加工-ISO认证厂家-鑫创盟 | 机构创新组合设计实验台_液压实验台_气动实训台-戴育教仪厂 | 宁夏档案密集柜,智能密集柜,电动手摇密集柜-盛隆柜业宁夏档案密集柜厂家 | 石膏基自流平砂浆厂家-高强石膏基保温隔声自流平-轻质抹灰石膏粉砂浆批发-永康市汇利建设有限公司 | 烟台条码打印机_烟台条码扫描器_烟台碳带_烟台数据采集终端_烟台斑马打印机-金鹏电子-金鹏电子 |