How to use merge-stream - 10 common examples

To help you get started, we’ve selected a few merge-stream examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twolfson / twolfson.com / gulpfile.js View on Github external
assert(entries);
    assert.strictEqual(entries.length, 1, 'Expected `browserifyObj` to only have "1" entry ' +
      'but got "' + entries.length + '" entries. Otherwise, we can\'t determine its output name');
    // /home/todd/.../public/js/articles/develop-faster.js -> articles/develop-faster.js
    var jsFilepath = path.relative(__dirname + '/public/js', entries[0]);
    jsStream = jsStream
      .pipe(vinylSourceStream(jsFilepath))
      .pipe(gulpBuffer());

    // Return our JS stream
    return jsStream;
  });

  // Join our files into 1 stream
  // DEV: We use 1 stream so size reports are in the same file
  var jsStream = mergeStream.apply(this, jsStreams);

  // Extract browserify inline sourcemaps into in-memory file
  jsStream = jsStream.pipe(gulpSourcemaps.init({loadMaps: true}));

  // If we are minifying assets, then minify them
  if (config.minifyAssets) {
    jsStream = jsStream
      .pipe(gulpUglify())
      .pipe(gulpSizereport({gzip: true}));
  }

  // Output sourcemaps in-memory to Vinyl file
  jsStream = jsStream.pipe(gulpSourcemaps.write('./'));

  // Return our stream
  return jsStream
github kerrishotts / Mastering-PhoneGap-Code-Package / logology-v12 / gulpfile.all.in.one.js View on Github external
copyAssets: function copyAssets() {
        return merge.apply(merge, ASSETS_TO_COPY.map(function (asset) {
            var fqSourcePath = path.join.apply(path, [SOURCE_DIR].concat(asset.src.split("/")));
            var fqTargetPath = path.join.apply(path, [BUILD_DIR].concat(asset.dest.split("/")));
            return gulp.src([fqSourcePath])
                       .pipe(gulp.dest(fqTargetPath));
        }).concat(projectTasks.copyConfig()))
        .pipe(browserSync.stream());
//
//        return merge(
//                gulp.src(["./build.json"])
//                    .pipe(gulp.dest(path.join(BUILD_DIR))),
//                gulp.src(["./src/www/*.*"])
//                    .pipe(gulp.dest(path.join(BUILD_DIR, "www"))),
//                gulp.src(["./src/www/html/**/*"])
//                    .pipe(gulp.dest(path.join(BUILD_DIR, "www", "html"))),
//                gulp.src(["./src/www/img/**/*"])
//                    .pipe(gulp.dest(path.join(BUILD_DIR, "www", "img"))),
github OnsenUI / OnsenUI / bindings / vue / gulpfile.babel.js View on Github external
function vueBindingsEsm() {
  const babelrc = Object.assign({}, corePkg.babel);
  babelrc.babelrc = babelrc.presets[0][1].modules = false;
  babelrc.plugins = [
    'external-helpers',
    'transform-runtime',
  ];

  // ES Modules (transpiled ES source codes)
  return mergeStream(
    gulp.src([
      'src/**/*.js',
      '!src/*.js',
    ])
    .pipe($.babel(babelrc))
    .pipe(gulp.dest('esm/')),

    // Compile Vue components
    gulp.src([
      'src/**/*.vue',
    ])
    .pipe($.vueCompiler({
      babel: babelrc,
      newExtension: 'js',
    }))
    .pipe(gulp.dest('esm/'))
github vigetlabs / blendid / gulp / tasks / browserify.js View on Github external
b.on('update', bundle);
      bundleLogger.watch(bundleConfig.outputName);
    } else {
      // Sort out shared dependencies.
      // b.require exposes modules externally
      if(bundleConfig.require) b.require(bundleConfig.require);
      // b.external excludes modules from the bundle, and expects
      // they'll be available externally
      if(bundleConfig.external) b.external(bundleConfig.external);
    }

    return bundle();
  };

  // Start bundling with Browserify for each bundleConfig specified
  return mergeStream.apply(gulp, _.map(config.bundleConfigs, browserifyThis));

};
github dowjones / gulp-bundle-assets / lib / bundle.js View on Github external
if (bundle.styles) {
      streams.push(gulp.src(bundle.styles, {base: '.'})
        .pipe(using(key, 'css'))
        .pipe(concat(key + '-bundle.css')) // todo src maps
        .pipe(gulp.dest(config.dest)));
    }

    if (bundle.resources) {
      streams.push(gulp.src(bundle.resources, {base: '.'})
        .pipe(using(key))
        .pipe(gulp.dest(config.dest)));
    }

  });

  return merge.apply(merge, streams);
}
github encryptic-team / encryptic / gulps / copy.js View on Github external
return () => {
        return merge.apply(merge, [
            gulp.src([
                './LICENSE',
            ], {base: './'})
            .pipe(gulp.dest($.distDir)),

            // Copy static files like images, locales, etc...
            gulp.src([
                './src/images/**/*.+(png|jpg|gif|ico|icns)',
                './src/docs/**',
                './src/locales/**/*.json',
                './src/.htaccess',
                './src/*.+(xml|ico|txt|webapp)',
                './src/styles/**/*.+(eot|svg|ttf|woff)',
            ], {base: './src'})
            .pipe(gulp.dest($.distDir)),
github StartPolymer / polymer-starter-kit-old / gulp / tasks / copy.js View on Github external
module.exports = function (gulp, plugins, config) { return function () {
  // Root dir '.tmp' is for any template engine, 'app' is for disabled it
  var rootDir = 'app';

  return require('merge-stream')(
    gulp.src([
        'app/*',
        '!app/test',
        '!app/*.jade'
      ], {
        dot: true
      }).pipe(gulp.dest('dist')),

    gulp.src([
      'bower_components/**/*.{css,html,js}',
      '!bower_components/**/{demo,index,metadata}.html'
      ])
      .pipe(gulp.dest('dist/bower_components')),

    gulp.src([
      rootDir + '/elements/**/*.{html,js}',
github nyaxt / otaru / webui / gulp / tasks / copy.js View on Github external
module.exports = function (gulp, plugins, config) { return function () {
  // Root dir '.tmp' is for any template engine, 'app' is for disabled it
  var rootDir = 'app';

  return require('merge-stream')(
    gulp.src([
        'app/*',
        '!app/test',
        '!app/*.jade'
      ], {
        dot: true
      }).pipe(gulp.dest('dist')),

    gulp.src([
      'bower_components/**/*.{css,html,js}',
      '!bower_components/**/{demo,index,metadata}.html'
      ])
      .pipe(gulp.dest('dist/bower_components')),

    gulp.src([
      rootDir + '/elements/**/*.{html,js}',
github Monofony / Monofony / assets / backend / gulpfile.babel.js View on Github external
export const buildAdminCss = function buildAdminCss() {
  const copyStream = merge(
    gulp.src(upath.joinSafe(nodeModulesPath, 'semantic-ui-css/themes/**/*'))
      .pipe(gulp.dest(upath.joinSafe(adminRootPath, 'css/themes'))),
  );

  const cssStream = gulp.src(paths.admin.css, { base: './' })
    .pipe(gulpif(options.sourcemaps, sourcemaps.init()))
    .pipe(concat('css-files.css'));

  const sassStream = gulp.src(paths.admin.sass, { base: './' })
    .pipe(gulpif(options.sourcemaps, sourcemaps.init()))
    .pipe(sass())
    .pipe(concat('sass-files.scss'));

  return merge(
    copyStream,
    merge(cssStream, sassStream)
github Sonoport / soundmodels / Gulpfile.js View on Github external
gulp.task('devbuild',['jsbeautify:src'], function(){

    del([paths.dirs.dist], function () {
        console.log('Cleaning old built assets.');
    });

    var modelStreams = createBundlerStreams(paths.files.modelsSrc, 'dist/models/');
    var effectsStreams = createBundlerStreams(paths.files.effectsSrc, 'dist/effects/');
    var coreStream = createBundlerStreams(paths.files.coreSrc, 'dist/core/');
    var indexStream = gulp.src(paths.files.releaseIndexSrc).pipe(gulp.dest(paths.dirs.dist));

    var combinedStreams = modelStreams.concat(effectsStreams).concat(coreStream).concat(indexStream);

    return merge.apply(this,combinedStreams);
});

merge-stream

Create a stream that emits events from multiple other streams

MIT
Latest version published 6 years ago

Package Health Score

71 / 100
Full package analysis

Similar packages