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

    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="qwawimqqmiuu" 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="qwawimqqmiuu" id='mCkHe'><tfoot id='mCkHe'></tfoot><dl id='mCkHe'><fieldset id='mCkHe'></fieldset></dl></div>
              • <bdo id='mCkHe'></bdo><ul id='mCkHe'></ul>

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

                  問題描述

                  限時送ChatGPT賬號..

                  我正在使用 gulp 對我的 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 時,在兩者之間保存臨時文件是 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)容的流式傳輸方式.自己寫東西會比較容易,或者你可以使用現(xiàn)有的插件.對我來說,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/'));
                  });
                  

                  你也可以只對你期望模式所在的文件執(zhí)行 gulp.src,并通過 gulp-replace 將它們單獨流式傳輸,將其與 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 替換文件中的字符串?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  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?(是否可以將標(biāo)志傳遞給 Gulp 以使其以不同的方式運行任務(wù)?)
                  Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                  How to run Gulp tasks sequentially one after the other(如何一個接一個地依次運行 Gulp 任務(wù))
                  Stylesheet not loaded because of MIME-type(由于 MIME 類型而未加載樣式表)
                  Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時 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="qwawimqqmiuu" 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>
                          • 主站蜘蛛池模板: 在线播放国产精品 | 一区二区三区国产视频 | 国产精品一区二区三区免费 | 色婷婷久久 | 欧美成人免费在线视频 | 美女福利网站 | 精品理论片 | 午夜激情视频 | 国产高清一区 | 色综合天天综合网天天狠天天 | 成人在线观看视频网站 | 超碰在线观看免费版 | 中文在线观看免费网站 | 久久精品国产免费 | 欧美精品在线观看 | 日本中文字幕在线 | 黄色a视频 | 一级免费看 | 欧美日韩三区 | 欧美特黄 | 欧美三级大片 | 国产成人精品视频 | 色一情一乱一乱一区91av | 伊人色综合网 | 福利小视频| 亚洲第一色 | 欧美日韩视频一区二区 | 国产精品毛片久久久久久久 | 一区视频在线 | 国产日韩在线视频 | 亚洲经典一区二区三区 | 国产黄色一级毛片 | 特黄毛片 | 成人高潮片免费网站 | 午夜成人在线视频 | 日日干夜夜骑 | 五月激情综合网 | 特级做a爱片免费69 伊人超碰在线 | 午夜视频网站 | 欧美第一页 | 亚洲精品乱码久久久久久蜜桃91 |