当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript gulp-cached类代码示例

本文整理汇总了TypeScript中gulp-cached的典型用法代码示例。如果您正苦于以下问题:TypeScript gulp-cached类的具体用法?TypeScript gulp-cached怎么用?TypeScript gulp-cached使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了gulp-cached类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: merge

task('demos.build', function () {
  var indexTemplate = template(
    readFileSync(`${SCRIPTS_ROOT}/${DEMOS_NAME}/demos.template.dev.html`).toString()
  )({
    buildConfig: buildConfig
  });

  // Get each test folder with src
  var tsResult = src([
    'demos/src/*/**/*.ts'
  ])
    .pipe(cache('demos.ts'))
    .pipe(tsc(getTscOptions(), undefined, tscReporter))
    .on('error', function (error) {
      console.log(error.message);
    })
    .pipe(gulpif(/app.module.js$/, createIndexHTML()));

  var testFiles = src([
    'demos/src/*/**/*',
    '!demos/src/*/**/*.ts'
  ])
    .pipe(cache('demos.files'));

  return merge([
    tsResult,
    testFiles
  ])
    .pipe(dest(DIST_DEMOS_ROOT))
    .pipe(connect.reload());

  function createIndexHTML() {
    return obj(function (file, enc, next) {
      this.push(new VinylFile({
        base: file.base,
        contents: new Buffer(indexTemplate),
        path: join(dirname(file.path), 'index.html'),
      }));
      next(null, file);
    });
  }
});
开发者ID:birdplane9527,项目名称:ionic,代码行数:42,代码来源:demos.dev.ts

示例2: tsCompile

function tsCompile(options, cacheName) {
  return src([
    'typings/main.d.ts',
    'src/**/*.ts',
    '!src/**/*.d.ts',
    '!src/components/*/test/**/*',
    '!src/util/test/*',
    '!src/config/test/*',
    '!src/platform/test/*',
    '!src/**/*.spec.ts'
  ])
    .pipe(cache(cacheName, { optimizeMemory: true }))
    .pipe(tsc(options, undefined, tscReporter));
}
开发者ID:fsdn,项目名称:ionic,代码行数:14,代码来源:e2e.dev.ts

示例3: merge

task('e2e.build', function () {
  var indexTemplate = template(
    readFileSync(`${SCRIPTS_ROOT}/${E2E_NAME}/e2e.template.dev.html`).toString()
  )({
    buildConfig: buildConfig
  });

  // Get each test folder with src
  var tsResult = src([
    'src/components/*/test/*/**/*.ts',
    '!src/components/*/test/*/**/*.spec.ts'
  ])
    .pipe(cache('e2e.ts'))
    .pipe(tsc(getTscOptions(), undefined, tscReporter))
    .on('error', function (error) {
      console.log(error.message);
    })
    .pipe(gulpif(/app-module.js$/, createIndexHTML()))
    .pipe(gulpif(/e2e.js$/, createPlatformTests()));

  var testFiles = src([
    'src/components/*/test/*/**/*',
    '!src/components/*/test/*/**/*.ts'
  ])
    .pipe(cache('e2e.files'));

  return merge([
    tsResult,
    testFiles
  ])
    .pipe(rename(function (file) {
      file.dirname = file.dirname.replace(sep + 'test' + sep, sep);
    }))
    .pipe(dest(DIST_E2E_ROOT))
    .pipe(connect.reload());

  function createIndexHTML() {
    return obj(function (file, enc, next) {
      this.push(new VinylFile({
        base: file.base,
        contents: new Buffer(indexTemplate),
        path: join(dirname(file.path), 'index.html'),
      }));
      next(null, file);
    });
  }

  function createPlatformTests() {
    let platforms = [
      'android',
      'ios',
      'windows'
    ];

    let testTemplate = template(readFileSync(`${SCRIPTS_ROOT}/${E2E_NAME}/e2e.template.js`).toString());

    return obj(function (file, enc, next) {
      let self = this;

      let relativePath = dirname(file.path.replace(/^.*?src(\/|\\)components(\/|\\)/, ''));
      relativePath = relativePath.replace('/test/', '/');

      let contents = file.contents.toString();
      platforms.forEach(function (platform) {
        let platformContents = testTemplate({
          contents: contents,
          buildConfig: buildConfig,
          relativePath: relativePath,
          platform: platform
        });
        self.push(new VinylFile({
          base: file.base,
          contents: new Buffer(platformContents),
          path: file.path.replace(/e2e.js$/, platform + '.e2e.js')
        }));
      });
      next();
    });
  }
});
开发者ID:fsdn,项目名称:ionic,代码行数:80,代码来源:e2e.dev.ts


注:本文中的gulp-cached类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。