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

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

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

      1. <tfoot id='CpnTh'></tfoot>

          <bdo id='CpnTh'></bdo><ul id='CpnTh'></ul>
      2. <legend id='CpnTh'><style id='CpnTh'><dir id='CpnTh'><q id='CpnTh'></q></dir></style></legend>
      3. 如何使用 gulp 替換文件中的字符串?

        How can I use gulp to replace a string in a file?(如何使用 gulp 替換文件中的字符串?)

            <tfoot id='mCkHe'></tfoot>

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

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

                  本文介紹了如何使用 gulp 替換文件中的字符串?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

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

                  我正在使用 gulp 對(duì)我的 javascript 文件進(jìn)行 uglify 并準(zhǔn)備好用于生產(chǎn).我所擁有的是這段代碼:

                  I am using gulp to uglify and make ready my javascript files for production. What I have is this code:

                  var concat = require('gulp-concat');
                  var del = require('del');
                  var gulp = require('gulp');
                  var gzip = require('gulp-gzip');
                  var less = require('gulp-less');
                  var minifyCSS = require('gulp-minify-css');
                  var uglify = require('gulp-uglify');
                  
                  var js = {
                      src: [
                          // more files here
                          'temp/js/app/appConfig.js',
                          'temp/js/app/appConstant.js',
                          // more files here
                      ],
                  
                  gulp.task('scripts', ['clean-js'], function () {
                      return gulp.src(js.src).pipe(uglify())
                        .pipe(concat('js.min.js'))
                        .pipe(gulp.dest('content/bundles/'))
                        .pipe(gzip(gzip_options))
                        .pipe(gulp.dest('content/bundles/'));
                  });
                  

                  我需要做的是替換字符串:

                  What I need to do is to replace the string:

                  dataServer: "http://localhost:3048",
                  

                  dataServer: "http://example.com",
                  

                  在文件'temp/js/app/appConstant.js'中,

                  In the file 'temp/js/app/appConstant.js',

                  我正在尋找一些建議.例如,也許我應(yīng)該復(fù)制 appConstant.js 文件,更改它(不確定如何)并將 appConstantEdited.js 包含在 js.src 中?

                  I'm looking for some suggestions. For example perhaps I should make a copy of the appConstant.js file, change that (not sure how) and include appConstantEdited.js in the js.src?

                  但我不確定 gulp 如何復(fù)制文件并替換文件中的字符串.

                  But I am not sure with gulp how to make a copy of a file and replace a string inside a file.

                  您提供的任何幫助將不勝感激.

                  Any help you give would be much appreciated.

                  推薦答案

                  Gulp 流式輸入,執(zhí)行所有轉(zhuǎn)換,然后流式輸出.使用 Gulp 時(shí),在兩者之間保存臨時(shí)文件是 AFAIK 非慣用的.

                  Gulp streams input, does all transformations, and then streams output. Saving temporary files in between is AFAIK non-idiomatic when using Gulp.

                  相反,您正在尋找的是一種替換內(nèi)容的流式傳輸方式.自己寫東西會(huì)比較容易,或者你可以使用現(xiàn)有的插件.對(duì)我來說,gulp-replace 效果很好.

                  Instead, what you're looking for, is a streaming-way of replacing content. It would be moderately easy to write something yourself, or you could use an existing plugin. For me, gulp-replace has worked quite well.

                  如果您想在所有文件中進(jìn)行替換,您可以像這樣輕松更改任務(wù):

                  If you want to do the replacement in all files it's easy to change your task like this:

                  var replace = require('gulp-replace');
                  
                  gulp.task('scripts', ['clean-js'], function () {
                      return gulp.src(js.src)
                        .pipe(replace(/http://localhost:d+/g, 'http://example.com'))
                        .pipe(uglify())
                        .pipe(concat('js.min.js'))
                        .pipe(gulp.dest('content/bundles/'))
                        .pipe(gzip(gzip_options))
                        .pipe(gulp.dest('content/bundles/'));
                  });
                  

                  你也可以只對(duì)你期望模式所在的文件執(zhí)行 gulp.src,并通過 gulp-replace 將它們單獨(dú)流式傳輸,將其與 gulp.src 之后所有其他文件的流.

                  You could also do gulp.src just on the files you expect the pattern to be in, and stream them seperately through gulp-replace, merging it with a gulp.src stream of all the other files afterwards.

                  這篇關(guān)于如何使用 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 崩潰)
                  <legend id='lOBTB'><style id='lOBTB'><dir id='lOBTB'><q id='lOBTB'></q></dir></style></legend>

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

                        <tfoot id='lOBTB'></tfoot>
                      • <small id='lOBTB'></small><noframes id='lOBTB'>

                            <bdo id='lOBTB'></bdo><ul id='lOBTB'></ul>
                          • 主站蜘蛛池模板: 福建自考_福建自学考试网| 招商帮-一站式网络营销服务|互联网整合营销|网络推广代运营|信息流推广|招商帮企业招商好帮手|搜索营销推广|短视视频营销推广 | 面粉仓_储酒罐_不锈钢储酒罐厂家-泰安鑫佳机械制造有限公司 | 煤粉取样器-射油器-便携式等速飞灰取样器-连灵动 | 作文导航网_作文之家_满分作文_优秀作文_作文大全_作文素材_最新作文分享发布平台 | 手术示教系统-数字化手术室系统-林之硕医疗云智能视频平台 | 杭州荣奥家具有限公司-浙江办公家具,杭州办公家具厂 | 环保袋,无纺布袋,无纺布打孔袋,保温袋,环保袋定制,环保袋厂家,环雅包装-十七年环保袋定制厂家 | 课件导航网_ppt课件_课件模板_课件下载_最新课件资源分享发布平台 | 干洗加盟网-洗衣店品牌排行-干洗设备价格-干洗连锁加盟指南 | 无锡装修装潢公司,口碑好的装饰装修公司-无锡索美装饰设计工程有限公司 | 蒜肠网-动漫,二次元,COSPLAY,漫展以及收藏型模型,手办,玩具的新媒体.(原变形金刚变迷TF圈) | 塑钢件_塑钢门窗配件_塑钢配件厂家-文安县启泰金属制品有限公司 深圳南财多媒体有限公司介绍 | 顶空进样器-吹扫捕集仪-热脱附仪-二次热解吸仪-北京华盛谱信仪器 | 酒万铺-酒水招商-酒水代理 | 培训一点通 - 合肥驾校 - 合肥新亚驾校 - 合肥八一驾校 | 壹车网 | 第一时间提供新车_资讯_报价_图片_排行! | 万家财经_财经新闻_在线财经资讯网 | 江苏农村商业银行招聘网_2024江苏农商行考试指南_江苏农商行校园招聘 | 民用音响-拉杆音响-家用音响-ktv专用音响-万昌科技 | 鼓风干燥箱_真空烘箱_高温干燥箱_恒温培养箱-上海笃特科学仪器 | 淘气堡_室内儿童乐园_户外无动力儿童游乐设备-高乐迪(北京) | 南京展台搭建-南京展会设计-南京展览设计公司-南京展厅展示设计-南京汇雅展览工程有限公司 | 振动台-振动试验台-振动冲击台-广东剑乔试验设备有限公司 | 阿里巴巴诚信通温州、台州、宁波、嘉兴授权渠道商-浙江联欣科技提供阿里会员办理 | 全自动翻转振荡器-浸出式水平振荡器厂家-土壤干燥箱价格-常州普天仪器 | 云南成人高考网| 找培训机构_找学习课程_励普教育 | 次氯酸钠厂家,涉水级次氯酸钠,三氯化铁生产厂家-淄博吉灿化工 | 蒸汽热收缩机_蒸汽发生器_塑封机_包膜机_封切收缩机_热收缩包装机_真空机_全自动打包机_捆扎机_封箱机-东莞市中堡智能科技有限公司 | 合肥角钢_合肥槽钢_安徽镀锌管厂家-昆瑟商贸有限公司 | 泰国试管婴儿_泰国第三代试管婴儿费用|成功率|医院—新生代海外医疗 | 上海瑶恒实业有限公司|消防泵泵|离心泵|官网| 北京网络营销推广_百度SEO搜索引擎优化公司_网站排名优化_谷歌SEO - 北京卓立海创信息技术有限公司 | 纳米二氧化硅,白炭黑,阴离子乳化剂-臻丽拾科技| 电表箱-浙江迈峰电力设备有限公司-电表箱专业制造商 | 欧版反击式破碎机-欧版反击破-矿山石料破碎生产线-青州奥凯诺机械 | 黑田精工电磁阀-CAMMOZI气缸-ROSS电磁-上海茂硕机械设备有限公司 | 英国雷迪地下管线探测仪-雷迪RD8100管线仪-多功能数字听漏仪-北京迪瑞进创科技有限公司 | 纳米二氧化硅,白炭黑,阴离子乳化剂-臻丽拾科技 | 山东螺杆空压机,烟台空压机,烟台开山空压机-烟台开山机电设备有限公司 |