当前位置: 首页>>代码示例>>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;未经允许,请勿转载。