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

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

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

        gulp:丑化和源圖

        gulp: uglify and sourcemaps(gulp:丑化和源圖)
          <tbody id='mdNhi'></tbody>

        <tfoot id='mdNhi'></tfoot>

            • <legend id='mdNhi'><style id='mdNhi'><dir id='mdNhi'><q id='mdNhi'></q></dir></style></legend>

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

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

                  <bdo id='mdNhi'></bdo><ul id='mdNhi'></ul>
                  本文介紹了gulp:丑化和源圖的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我正在使用 gulp.

                  I am using gulp.

                  我想要一個或多個 JS 文件(比如 jQuery)將它們組合成一個,縮小它,并將其寫入分發文件夾.

                  I would like to having one or multiple JS files (say jQuery) to combine them in one, minify it, and write it to a distribution folder.

                  這就是我的做法:

                  minifyJS(['/js/myModule.file1.js',
                            '/js/myModule.file2.js'], '/dist/js', 'myModule')
                  

                  功能:

                  function minifyJS(sourceFiles, destinationFolder, filenameRoot) {
                      return gulp.src(sourceFiles)
                          .pipe(plumber())
                  
                          // .pipe(sourcemaps.init()) here ???
                          .pipe(concat(filenameRoot + '.js'))
                          .pipe(sourcemaps.init()) // or here ???
                  
                          .pipe(gulp.dest(destinationFolder)) // save .js
                          .pipe(uglify({ preserveComments: 'license' }))
                          .pipe(rename({ extname: '.min.js' }))
                          .pipe(gulp.dest(destinationFolder)) // save .min.js
                          .pipe(sourcemaps.write('maps'))
                          .pipe(gulp.dest(destinationFolder)) // save .map
                  }
                  

                  我不確定的是 sourcemaps.init() 位置...

                  What I am not sure about is the sourcemaps.init() location...

                  我應該創建多個(在我的情況下為 2 個)地圖文件(如果瀏覽器支持那就太好了)還是只創建一個 (/maps/myModule.map)?

                  Should I create multiple (2 in my case) map files (that would be nice if is supported by browsers) or only one (/maps/myModule.map)?

                  推薦答案

                  這就是 sourcemap 在 Gulp 中的工作方式:您通過 gulp.src 選擇的每個元素都會傳輸到一個虛擬文件對象中,包括緩沖區中的內容,以及原始文件名.這些通過您的流傳輸,內容在其中進行轉換.

                  So this is how sourcemaps work in Gulp: Each element you select via gulp.src gets transferred into a virtual file object, consisting of the contents in a Buffer, as well as the original file name. Those are piped through your stream, where the contents get transformed.

                  如果您添加源映射,您將向這些虛擬文件對象添加一個屬性,即源映射.每次轉換時,源映射也會被轉換.因此,如果您在 concat 之后和 uglify 之前初始化 sourcemap,則 sourcemap 會存儲該特定步驟的轉換.源映射認為"原始文件是 concat 的輸出,發生的唯一轉換步驟是 uglify 步驟.所以當你在瀏覽器中打開它們時,什么都不會匹??配.

                  If you add sourcemaps, you add one more property to those virtual file objects, namely the sourcemap. With each transformation, the sourcemap gets also transformed. So, if you initialize the sourcemaps after concat and before uglify, the sourcemaps stores the transformations from that particular step. The sourcemap "thinks" that the original files are the output from concat, and the only transformation step that took place is the uglify step. So when you open them in your browser, nothing will match.

                  最好在 globbing 之后直接放置 sourcemap,并在保存結果之前直接保存它們.Gulp 源圖將在轉換之間進行插值,以便您跟蹤發生的每一個變化.原始源文件將是您選擇的源文件,并且源映射將追溯到這些來源.

                  It's better that you place sourcemaps directly after globbing, and save them directly before saving your results. Gulp sourcemaps will interpolate between transformations, so that you keep track of every change that happened. The original source files will be the ones you selected, and the sourcemap will track back to those origins.

                  這是你的直播:

                   return gulp.src(sourceFiles)
                      .pipe(sourcemaps.init())
                      .pipe(plumber())
                      .pipe(concat(filenameRoot + '.js'))
                      .pipe(gulp.dest(destinationFolder)) // save .js
                      .pipe(uglify({ preserveComments: 'license' }))
                      .pipe(rename({ extname: '.min.js' }))
                      .pipe(sourcemaps.write('maps'))
                      .pipe(gulp.dest(destinationFolder)) // save .min.js
                  

                  sourcemaps.write 實際上并不編寫 sourcemaps,它只是告訴 Gulp 在您調用 gulp.dest 時將它們具體化為一個物理文件.

                  sourcemaps.write does not actually write sourcemaps, it just tells Gulp to materialize them into a physical file when you call gulp.dest.

                  Gulp 4 原生包含相同的 sourcemap 插件:http://fettblog.eu/gulp-4-sourcemaps/ -- 如果你想了解更多關于源映射如何在 Gulp 內部工作的詳細信息,請參閱我的 Gulp 書的第 6 章:http://www.manning.com/baumgartner

                  The very same sourcemap plugin will be included in Gulp 4 natively: http://fettblog.eu/gulp-4-sourcemaps/ -- If you want to have more details on how sourcemaps work internally with Gulp, they are in Chapter 6 of my Gulp book: http://www.manning.com/baumgartner

                  這篇關于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 崩潰)

                  <small id='7ZjJL'></small><noframes id='7ZjJL'>

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

                          <tbody id='7ZjJL'></tbody>

                      1. <tfoot id='7ZjJL'></tfoot>
                      2. <legend id='7ZjJL'><style id='7ZjJL'><dir id='7ZjJL'><q id='7ZjJL'></q></dir></style></legend>

                            <bdo id='7ZjJL'></bdo><ul id='7ZjJL'></ul>
                          • 主站蜘蛛池模板: 一级aaaaaa毛片免费同男同女 | 国产一级免费视频 | 91精品国产一二三 | 手机在线一区二区三区 | 欧美美女爱爱视频 | 成人网视频 | 日韩一区二区在线免费观看 | 亚洲欧美日韩在线 | 亚洲毛片 | 91porn成人精品 | 热re99久久精品国99热观看 | 日本午夜网站 | 天天操操操操操 | 青青草视频网 | av色站| 懂色中文一区二区三区在线视频 | 欧美日韩精品在线一区 | 亚洲精品一区中文字幕 | 国产天堂| 国产高清视频在线观看 | 久久人人爽人人爽 | 激情黄色在线观看 | 一级片网址 | 日韩一区二区三区在线播放 | 精品免费国产一区二区三区 | 亚洲精选久久 | 欧美激情在线观看一区二区三区 | 天天舔天天 | 精品一二三区在线观看 | 成人自拍av | 国产精品成人一区二区三区 | 国产剧情久久 | av毛片在线播放 | 自拍偷拍视频网 | 精品欧美色视频网站在线观看 | 成人中文字幕av | 欧美久久久网站 | 黄色av网站在线观看 | 国产精品久久久久久久一区二区 | 婷婷综合在线 | 亚洲毛片网站 |