當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript merge-stream類代碼示例

本文整理匯總了TypeScript中merge-stream的典型用法代碼示例。如果您正苦於以下問題:TypeScript merge-stream類的具體用法?TypeScript merge-stream怎麽用?TypeScript merge-stream使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了merge-stream類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

  return function() {
    // https://www.npmjs.com/package/merge-stream
    return merge(copyProjectInternalAsets(), copyProjectExternalAsets());

    // copies all external asset dependencies (d.asset === true)
    // to their designated destionations (d.dest)
    function copyProjectExternalAsets() {
      var externalAssetFiles = DEV_DEPENDENCIES.filter(d => d.asset);
      // http://stackoverflow.com/questions/26784094/can-i-use-a-gulp-task-with-multiple-sources-and-multiple-destinations
      var tasks = externalAssetFiles.map(function(element) {
        // https://github.com/gulpjs/gulp/blob/master/docs/API.md#gulpsrcglobs-options
        return gulp.src(element.src)
          // https://github.com/gulpjs/gulp/blob/master/docs/API.md#gulpdestpath-options
          .pipe(gulp.dest(element.dest));
      });

      return merge(...tasks);
    }

    // copies set of asset files (not *.ts) from APP_SRC to APP_DEST
    //  it will copy js files, css, html files,
    function copyProjectInternalAsets() {
      return gulp.src([
        join(APP_SRC, '**'),
        '!' + join(APP_SRC, '**', '*.ts')
      ])
        .pipe(gulp.dest(APP_DEST));
    }
  };
開發者ID:mprinc,項目名稱:angular2-material-seed,代碼行數:29,代碼來源:build.assets.dev.ts

示例2: function

  return function () {
    let debug = false;

    // https://www.npmjs.com/package/merge-stream
    return merge(minifyComponentCss(), prepareTemplates(), processExternalCss());

    // copies html templates to tmp dir
    function prepareTemplates() {
      return gulp.src(join(APP_SRC, '**', '*.html'))
        .pipe(gulp.dest(TMP_DIR));
    }

    // minify css files from the project
    // TODO: mprinc:
    // - not sure why not minifying assets?
    // - probable because assets are something that we are not working on,
    //  but just providing to the project output
    // still it would make sense to minify them or at least concat them together
    function minifyComponentCss() {
      return gulp.src([
          join(APP_SRC, '**', '*.css'),
          '!' + join(APP_SRC, 'assets', '**', '*.css')
        ])
        // https://www.npmjs.com/package/gulp-cssnano
        .pipe(plugins.cssnano())
        .pipe(gulp.dest(TMP_DIR));
    }

    // gets external css from PROD_DEPENDENCIES (config.ts file)
    // minifies them into CSS_PROD_BUNDLE and stores in CSS_DEST (config.ts file)
    function processExternalCss() {
      var externalCssFiles = getExternalCss().map(r => r.src);
      if(debug) plugins.util.log('[processExternalCss] externalCssFiles: ', externalCssFiles);
      // if(debug) plugins.util.log('[processExternalCss] CSS_PROD_BUNDLE: ', CSS_PROD_BUNDLE);
      // if(debug) plugins.util.log('[processExternalCss] CSS_DEST: ', CSS_DEST);
      let stream = gulp.src(externalCssFiles)
        .pipe(plugins.sniff('processExternalCss', {detailed: true}))
        .pipe(plugins.cssnano())
        .pipe(plugins.concat(CSS_PROD_BUNDLE))
        .pipe(gulp.dest(CSS_DEST));

        stream.on('end', function() {
            if(debug) plugins.util.log(plugins.util.colors.blue("[build.js.prod:processExternalCss]"),
                plugins.sniff.get("processExternalCss"));
        });

    return stream;
    }

    // get css files from external dependencies listed in
    // config.ts file under PROD_DEPENDENCIES
    function getExternalCss() {
        var externalCssFiles = PROD_DEPENDENCIES.filter(d => /\.css$/.test(d.src));
        // if(debug) plugins.util.log('[getExternalCss] externalCssFiles: ', externalCssFiles);
      return externalCssFiles;
    }
  };
開發者ID:Cha-OS,項目名稱:collabo-flow-visual-frontend,代碼行數:57,代碼來源:build.html_css.prod.ts

示例3: function

  return function () {

    return merge(bundleShims());

    // get sources of *.js dependencies that .inject are either shims or libs or true
    function getShims() {
      let libs = PROD_DEPENDENCIES
        .filter(d => /\.js$/.test(d.src));
      return libs.filter(l => l.inject === 'shims')
        .concat(libs.filter(l => l.inject === 'libs'))
        .concat(libs.filter(l => l.inject === true))
        .map(l => l.src);
    }

    function bundleShims() {
      return gulp.src(getShims())
      // Minify files with UglifyJS
      // https://www.npmjs.com/package/gulp-uglify
      // Strip comments and sourcemaps
      .pipe(plugins.uglify({
        mangle: false
      }))
      .pipe(plugins.concat(JS_PROD_SHIMS_BUNDLE))
      .pipe(gulp.dest(JS_DEST));
    }
  };
開發者ID:mprinc,項目名稱:angular2-material-seed,代碼行數:26,代碼來源:build.bundles.ts

示例4: function

  return function () {

    return merge(bundleShims(), bundleApp());

    function getShims() {
      let libs = PROD_DEPENDENCIES
        .filter(d => /\.js$/.test(d.src));
      return libs.filter(l => l.inject === 'shims')
        .concat(libs.filter(l => l.inject === 'libs'))
        .concat(libs.filter(l => l.inject === true))
        .map(l => l.src);
    }

    function bundleShims() {
      return gulp.src(getShims())
      // Strip comments and sourcemaps
      .pipe(plugins.uglify({
        mangle: false
      }))
      .pipe(plugins.concat(JS_PROD_SHIMS_BUNDLE))
      .pipe(gulp.dest(JS_DEST));
    }

    function bundleApp() {
      return browserify(join(TMP_DIR, 'main'))
        .bundle()
        .pipe(require('vinyl-source-stream')(JS_PROD_APP_BUNDLE))
        .pipe(require('vinyl-buffer')())
        .pipe(plugins.uglify({
          mangle: false
        }))
        .pipe(gulp.dest(JS_DEST));
    }
  };
開發者ID:HilmiDEV,項目名稱:viewchildren-contentchildren-demo,代碼行數:34,代碼來源:build.bundles.ts

示例5: function

  return function () {

    return merge(buildSass(), minifyComponentCss(), prepareTemplates(), processExternalCss());

    function prepareTemplates() {
      return gulp.src(join(TMP_SRC, '**', '*.html'))
        .pipe(gulp.dest(TMP_DIR));
    }

    function buildSass() {
      return gulp.src(join(TMP_SRC, '**', '*.scss'))
        .pipe(plugins.sass().on('error', plugins.sass.logError))
        .pipe(gulp.dest(TMP_SRC));
    }

    function minifyComponentCss() {
      return gulp.src([
          join(TMP_SRC, '**', '*.css'),
          '!' + join(TMP_SRC, 'assets', '**', '*.css')
        ])
        .pipe(plugins.cssnano())
        .pipe(gulp.dest(TMP_DIR));
    }

    function processExternalCss() {
      return gulp.src(getExternalCss().map(r => r.src))
        .pipe(plugins.cssnano())
        .pipe(plugins.concat(CSS_PROD_BUNDLE))
        .pipe(gulp.dest(CSS_DEST));
    }

    function getExternalCss() {
      return PROD_DEPENDENCIES.filter(d => /\.css$/.test(d.src));
    }
  };
開發者ID:teyosh,項目名稱:angular2-seed,代碼行數:35,代碼來源:build.html_sass.prod.ts

示例6: function

  return function () {

    return merge(minifyComponentCss(), prepareTemplates(), processExternalCss());

    function prepareTemplates() {
      return gulp.src(join(APP_SRC, "**", "*.html"))
        .pipe(gulp.dest(TMP_DIR));
    }

    function minifyComponentCss() {
      return gulp.src([
          join(APP_SRC, "**", "*.css"),
          "!" + join(APP_SRC, "assets", "**", "*.css")
        ])
        .pipe(plugins.cssnano())
        .pipe(gulp.dest(TMP_DIR));
    }

    function processExternalCss() {
      return gulp.src(getExternalCss().map(r => r.src))
        .pipe(plugins.cssnano())
        .pipe(plugins.concat(CSS_PROD_BUNDLE))
        .pipe(gulp.dest(CSS_DEST));
    }

    function getExternalCss() {
      return PROD_DEPENDENCIES.filter(d => /\.css$/.test(d.src));
    }
  };
開發者ID:wuyingki,項目名稱:angular2-seed,代碼行數:29,代碼來源:build.html_css.prod.ts

示例7: function

  return function() {

    return merge(buildComponentCss(), processExternalCss());

    function buildComponentCss() {
    return gulp.src([
      join(APP_SRC, '**', '*.scss'),
      '!' + join(APP_SRC, 'assets', '**', '*.css')
    ])
      .pipe(plugins.sass({ errLogToConsole: false }))
      .pipe(plugins.autoprefixer({ browsers: ['last 2 version'] }))
      .pipe(plugins.cssnano())
      .pipe(gulp.dest(TMP_DIR));
    }

    function processExternalCss() {
      return gulp.src(getExternalCss().map(r => r.src))
        .pipe(plugins.cssnano())
        .pipe(plugins.concat(CSS_PROD_BUNDLE))
        .pipe(gulp.dest(CSS_DEST));
    }

    function getExternalCss() {
      return PROD_DEPENDENCIES.filter(d => /\.css$/.test(d.src));
    }
  };
開發者ID:saipranav,項目名稱:invite-frontend,代碼行數:26,代碼來源:build.css.prod.ts

示例8: function

  return function () {

    return merge(bundleShims());

    function getShims() {
      let libs = PROD_DEPENDENCIES
        .filter(d => /\.js$/.test(d.src));
      return libs.filter(l => l.inject === 'shims')
        .concat(libs.filter(l => l.inject === 'libs'))
        .concat(libs.filter(l => l.inject === true))
        .map(l => l.src);
    }

    // This takes, PROD_DEPENDENCIES from config, and looks for JS,SHIMS,Libs files in specified path
    // adds them to a common JS bundle (Shimps.js) and saves them to a JS_DEST.
    function bundleShims() {
      return gulp.src(getShims())
      // Strip comments and sourcemaps
      .pipe(debug({title:'build.bundle.getShims.src'}))
      .pipe(plugins.uglify({
        mangle: false
      }))
      .pipe(debug({title:'build.bundle.getShims.uglify'}))
      .pipe(plugins.concat(JS_PROD_SHIMS_BUNDLE))
      .pipe(debug({title:'build.bundle.JS_PROD_SHIMS_BUNDLE.concat'}))
      .pipe(gulp.dest(JS_DEST))
      .pipe(debug({title:'build.bundle.JS_DEST.concat'}));
    }
  };
開發者ID:kambojankit,項目名稱:angular2-seed,代碼行數:29,代碼來源:build.bundlesW.ts

示例9: merge

 run() {
   return merge(
     copyAssets(),
     copyAppResources(),
     copyAppFonts(),
     copyFiles([join(Config.TNS_APP_SRC, 'package.json')], ''),
   );
 }
開發者ID:chnoumis,項目名稱:angular2-seed-advanced,代碼行數:8,代碼來源:build.assets.tns.ts

示例10: copyProjectExternalAsets

    // copies all external asset dependencies (d.asset === true)
    // to their designated destionations (d.dest)
    function copyProjectExternalAsets() {
      var externalAssetFiles = PROD_DEPENDENCIES.filter(d => d.asset);
      // http://stackoverflow.com/questions/26784094/can-i-use-a-gulp-task-with-multiple-sources-and-multiple-destinations
      var tasks = externalAssetFiles.map(function(element){
        // https://github.com/gulpjs/gulp/blob/master/docs/API.md#gulpsrcglobs-options
        return gulp.src(element.src)
            // https://github.com/gulpjs/gulp/blob/master/docs/API.md#gulpdestpath-options
            .pipe(gulp.dest(element.dest));
      });

      return merge(...tasks);
    }
開發者ID:mprinc,項目名稱:angular2-material-seed,代碼行數:14,代碼來源:build.assets.prod.ts


注:本文中的merge-stream類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。