<bdo id='8j3dE'></bdo><ul id='8j3dE'></ul>

      <small id='8j3dE'></small><noframes id='8j3dE'>

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

      1. <tfoot id='8j3dE'></tfoot>

        <legend id='8j3dE'><style id='8j3dE'><dir id='8j3dE'><q id='8j3dE'></q></dir></style></legend>
      2. 如何使用 Gulp.js 将流保存到多个目的地?

        时间:2023-05-28

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

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

                    <tbody id='Nfdzk'></tbody>
                  <legend id='Nfdzk'><style id='Nfdzk'><dir id='Nfdzk'><q id='Nfdzk'></q></dir></style></legend>

                  本文介绍了如何使用 Gulp.js 将流保存到多个目的地?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..
                  const gulp = require('gulp');
                  const $ = require('gulp-load-plugins')();
                  const source = require('vinyl-source-stream');
                  const browserify = require('browserify');
                  
                  gulp.task('build', () =>
                    browserify('./src/app.js').bundle()
                      .pipe(source('app.js'))
                      .pipe(gulp.dest('./build'))       // OK. app.js is saved.
                      .pipe($.rename('app.min.js'))
                      .pipe($.streamify($.uglify())
                      .pipe(gulp.dest('./build'))       // Fail. app.min.js is not saved.
                  );
                  

                  当前不支持当 file.contents 为流时通过管道传输到多个目标.有什么办法可以解决这个问题?

                  Piping to multiple destinations when file.contents is a stream is not currently supported. What is a workaround for this problem?

                  推荐答案

                  目前在使用 file.contents 作为流时,每个 dest 必须使用两个流.这可能会在未来得到解决.

                  Currently you have to use two streams for each dest when using file.contents as a stream. This will probably be fixed in the future.

                  var gulp       = require('gulp');
                  var rename     = require('gulp-rename');
                  var streamify  = require('gulp-streamify');
                  var uglify     = require('gulp-uglify');
                  var source     = require('vinyl-source-stream');
                  var browserify = require('browserify');
                  var es         = require('event-stream');
                  
                  gulp.task('scripts', function () {
                      var normal = browserify('./src/index.js').bundle()
                          .pipe(source('bundle.js'))
                          .pipe(gulp.dest('./dist'));
                  
                      var min = browserify('./src/index.js').bundle()
                          .pipe(rename('bundle.min.js'))
                          .pipe(streamify(uglify())
                          .pipe(gulp.dest('./dist'));
                  
                      return es.concat(normal, min);
                  });
                  

                  此错误现已在 gulp 中修复.您原始帖子中的代码应该可以正常工作.

                  This bug is now fixed in gulp. The code in your original post should work fine.

                  这篇关于如何使用 Gulp.js 将流保存到多个目的地?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Gulp 错误:监视任务必须是一个函数 下一篇:gulp:丑化和源图

                  相关文章

                  最新文章

                1. <tfoot id='DR4Ef'></tfoot>
                    • <bdo id='DR4Ef'></bdo><ul id='DR4Ef'></ul>

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

                  1. <legend id='DR4Ef'><style id='DR4Ef'><dir id='DR4Ef'><q id='DR4Ef'></q></dir></style></legend>

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