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

    <bdo id='HR4tj'></bdo><ul id='HR4tj'></ul>
    1. <legend id='HR4tj'><style id='HR4tj'><dir id='HR4tj'><q id='HR4tj'></q></dir></style></legend>

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

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

      <tfoot id='HR4tj'></tfoot>

      1. 如何在 Gulp 中使用 Browserify 丑化輸出?

        How to uglify output with Browserify in Gulp?(如何在 Gulp 中使用 Browserify 丑化輸出?)
          • <i id='PTie2'><tr id='PTie2'><dt id='PTie2'><q id='PTie2'><span id='PTie2'><b id='PTie2'><form id='PTie2'><ins id='PTie2'></ins><ul id='PTie2'></ul><sub id='PTie2'></sub></form><legend id='PTie2'></legend><bdo id='PTie2'><pre id='PTie2'><center id='PTie2'></center></pre></bdo></b><th id='PTie2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='PTie2'><tfoot id='PTie2'></tfoot><dl id='PTie2'><fieldset id='PTie2'></fieldset></dl></div>
          • <legend id='PTie2'><style id='PTie2'><dir id='PTie2'><q id='PTie2'></q></dir></style></legend>

            <tfoot id='PTie2'></tfoot>
              <tbody id='PTie2'></tbody>
              <bdo id='PTie2'></bdo><ul id='PTie2'></ul>

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

                  本文介紹了如何在 Gulp 中使用 Browserify 丑化輸出?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我試圖在 Gulp 中對 Browserify 的輸出進行 uglify,但它不起作用.

                  I tried to uglify output of Browserify in Gulp, but it doesn't work.

                  gulpfile.js

                  var browserify = require('browserify');
                  var gulp = require('gulp');
                  var uglify = require('gulp-uglify');
                  var source = require('vinyl-source-stream');
                  
                  gulp.task('browserify', function() {
                      return browserify('./source/scripts/app.js')
                          .bundle()
                          .pipe(source('bundle.js'))
                          .pipe(uglify()) // ???
                          .pipe(gulp.dest('./build/scripts'));
                  });
                  

                  據我了解,我無法按照以下步驟進行操作.我需要在一個管道中制作以保留序列嗎?

                  As I understand I cannot make it in steps as below. Do I need to make in one pipe to preserve the sequence?

                  gulp.task('browserify', function() {
                      return browserify('./source/scripts/app.js')
                          .bundle()
                          .pipe(source('bundle.js'))
                          .pipe(uglify()) // ???
                          .pipe(gulp.dest('./source/scripts'));
                  });
                  
                  gulp.task('scripts', function() {
                      return grunt.src('./source/scripts/budle.js')
                          .pipe(uglify())
                          .pipe(gulp.dest('./build/scripts'));
                  });
                  
                  gulp.task('default', function(){
                      gulp.start('browserify', 'scripts');
                  });
                  

                  推薦答案

                  其實你們已經很接近了,除了一件事:

                  You actually got pretty close, except for one thing:

                  • 您需要將 source() 給出的 streaming 乙烯基文件對象轉換為 vinyl-buffer 因為 gulp-uglify(和大多數 gulp 插件)適用于緩沖乙烯基文件對象
                  • you need to convert the streaming vinyl file object given by source() with vinyl-buffer because gulp-uglify (and most gulp plugins) works on buffered vinyl file objects

                  所以你會用這個來代替

                  var browserify = require('browserify');
                  var gulp = require('gulp');
                  var uglify = require('gulp-uglify');
                  var source = require('vinyl-source-stream');
                  var buffer = require('vinyl-buffer');
                  
                  gulp.task('browserify', function() {
                    return browserify('./source/scripts/app.js')
                      .bundle()
                      .pipe(source('bundle.js')) // gives streaming vinyl file object
                      .pipe(buffer()) // <----- convert from streaming to buffered vinyl file object
                      .pipe(uglify()) // now gulp-uglify works 
                      .pipe(gulp.dest('./build/scripts'));
                  });
                  

                  或者,您可以選擇使用 vinyl-transform 代替它為您處理 streamingbuffered 乙烯基文件對象,例如所以

                  Or, you can choose to use vinyl-transform instead which takes care of both streaming and buffered vinyl file objects for you, like so

                  var gulp = require('gulp');
                  var browserify = require('browserify');
                  var transform = require('vinyl-transform');
                  var uglify = require('gulp-uglify');
                  
                  
                  gulp.task('build', function () {
                  
                    // use `vinyl-transform` to wrap the regular ReadableStream returned by `b.bundle();` with vinyl file object
                    // so that we can use it down a vinyl pipeline
                    // while taking care of both streaming and buffered vinyl file objects
                    var browserified = transform(function(filename) {
                      // filename = './source/scripts/app.js' in this case
                      return browserify(filename)
                        .bundle();
                    });
                  
                    return gulp.src(['./source/scripts/app.js']) // you can also use glob patterns here to browserify->uglify multiple files
                      .pipe(browserified)
                      .pipe(uglify())
                      .pipe(gulp.dest('./build/scripts'));
                  });
                  

                  以上兩種方法都可以達到相同的效果.

                  Both of the above recipes will achieve the same thing.

                  這只是關于您希望如何管理管道(在常規 NodeJS 流和流式乙烯基文件對象和緩沖乙烯基文件對象之間進行轉換)

                  Its just about how you want to manage your pipes (converting between regular NodeJS Streams and streaming vinyl file objects and buffered vinyl file objects)

                  我寫了一篇關于使用 gulp + browserify 和不同方法的較長文章:https://medium.com/@sogko/gulp-browserify-the-gulp-y-way-bb359b3f9623

                  I've written a longer article regarding using gulp + browserify and different approaches at: https://medium.com/@sogko/gulp-browserify-the-gulp-y-way-bb359b3f9623

                  這篇關于如何在 Gulp 中使用 Browserify 丑化輸出?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 崩潰)
                1. <tfoot id='rLN57'></tfoot>
                      • <bdo id='rLN57'></bdo><ul id='rLN57'></ul>
                        <i id='rLN57'><tr id='rLN57'><dt id='rLN57'><q id='rLN57'><span id='rLN57'><b id='rLN57'><form id='rLN57'><ins id='rLN57'></ins><ul id='rLN57'></ul><sub id='rLN57'></sub></form><legend id='rLN57'></legend><bdo id='rLN57'><pre id='rLN57'><center id='rLN57'></center></pre></bdo></b><th id='rLN57'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='rLN57'><tfoot id='rLN57'></tfoot><dl id='rLN57'><fieldset id='rLN57'></fieldset></dl></div>
                      • <legend id='rLN57'><style id='rLN57'><dir id='rLN57'><q id='rLN57'></q></dir></style></legend>

                          <tbody id='rLN57'></tbody>

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

                            主站蜘蛛池模板: 欧美中文在线 | 成人性视频免费网站 | 91免费在线看 | 国产一区二区在线观看视频 | 国产精品一区二区三区在线播放 | 国产小视频在线观看 | 久久国产精品视频观看 | 伦理午夜电影免费观看 | 亚洲视频免费观看 | 亚洲麻豆 | www.99热.com | 亚洲精品在线视频 | av大片 | 精品欧美一区二区三区精品久久 | 亚洲精品久久久久久久不卡四虎 | 精品国产乱码久久久久久88av | 亚洲 中文 欧美 日韩 在线观看 | 亚洲一区二区av在线 | 99精品视频免费在线观看 | 国产1区2区3区 | 日韩精品久久久久 | 成人午夜性成交 | 91亚洲精品久久久电影 | 久久一日本道色综合久久 | 免费观看av | 国产成人精品久久二区二区 | 国产精品一区二区久久久久 | 精品一区二区视频 | 日本亚洲精品成人欧美一区 | 91视频网址| 91久久精品一区二区二区 | 黄色一级毛片 | 精品一区av| 国产欧美在线视频 | 久久精品99 | 日韩二三区 | 亚洲激情自拍偷拍 | 欧美一级免费看 | 亚洲视频在线播放 | 丁香婷婷久久久综合精品国产 | 最新午夜综合福利视频 |