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


TypeScript gulp-if类代码示例

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


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

示例1: getOptimizeStreams

export function getOptimizeStreams(options?: OptimizeOptions):
    NodeJS.ReadWriteStream[] {
  options = options || {};
  const streams = [];

  // compile ES6 JavaScript using babel
  if (options.js && options.js.compile) {
    streams.push(gulpif(/\.js$/, new JSDefaultCompileTransform()));
  }

  // minify code (minify should always be the last transform)
  if (options.html && options.html.minify) {
    streams.push(gulpif(
        /\.html$/,
        new HTMLOptimizeTransform(
            {collapseWhitespace: true, removeComments: true})));
  }
  if (options.css && options.css.minify) {
    streams.push(
        gulpif(/\.css$/, new CSSMinifyTransform({stripWhitespace: true})));
    // TODO(fks): Remove this InlineCSSOptimizeTransform stream once CSS
    // is properly being isolated by splitHtml() & rejoinHtml().
    streams.push(gulpif(
        /\.html$/, new InlineCSSOptimizeTransform({stripWhitespace: true})));
  }
  if (options.js && options.js.minify) {
    streams.push(gulpif(/\.js$/, new JSDefaultMinifyTransform()));
  }

  return streams;
};
开发者ID:fwielstra,项目名称:polymer-cli,代码行数:31,代码来源:optimize-streams.ts

示例2: function

gulp.task('html', function () {
    return gulp.src('app/*.html')
        .pipe(useref())
        .pipe(gulpif(f => f.path.endsWith('.js'), uglify()))
        .pipe(gulpif(f => f.path.endsWith('.css'), minifyCss()))
        .pipe(gulp.dest('dist'));
});
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:7,代码来源:gulp-useref-tests.ts

示例3: function

gulp.task('html', function () {
    return gulp.src('app/*.html')
        .pipe(useref())
        .pipe(gulpif('*.js', uglify()))
        .pipe(gulpif('*.css', minifyCss()))
        .pipe(gulp.dest('dist'));
});
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:7,代码来源:gulp-useref-tests.ts

示例4: typescriptTask

export function typescriptTask(enableSourcemaps: boolean = false) {
  let files = [`${DIR_SRC}/**/*.ts`, 'typings/browser/**/*.d.ts'];
  return gulp.src(files, {base: DIR_SRC})
      .pipe(gulpif(enableSourcemaps, sourcemaps.init()))
      .pipe(typescript(project))
      .pipe(gulpif(enableSourcemaps, sourcemaps.write()))
      .pipe(gulp.dest(DIR_TMP));
}
开发者ID:Farata,项目名称:polymer-typescript-starter,代码行数:8,代码来源:common.ts

示例5: createIndexHTML

task('demos.copySource', (done: Function) => {
  const stream = src([`${DEMOS_SRC_ROOT}/**/*`])
    .pipe(gulpif(/app.module.ts$/, createIndexHTML()))
    .pipe(dest(DIST_DEMOS_ROOT));

  stream.on('end', done);

  function createIndexHTML() {
    const indexTemplate = readFileSync(`${SCRIPTS_ROOT}/${DEMOS_NAME}/demos.template.prod.html`);
    const indexTs = readFileSync(`${SCRIPTS_ROOT}/${DEMOS_NAME}/main.ts`);

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

示例6: join

export = () => {
    let debug: boolean = argv.debug;
    let dir=join(Config.TMP_DIR, 'jslocal');
    let serviceWorkerFiles = join(dir, '**/service-worker*.js');
    let normalFiles=[join(dir, '**/*.js'),
                    '!' + serviceWorkerFiles];
    if (debug) {
        console.log('copy.js.local - normal files: ', normalFiles);
        console.log('copy.js.local - service worker files: ', serviceWorkerFiles);
    }
    gulp.src(normalFiles)
        .pipe(gulpif(debug, gulpdebug({title:'copy.js.local normal files'})))
        .pipe(gulp.dest(Config.JS_DEST));
    gulp.src(serviceWorkerFiles)
        .pipe(gulpif(debug, gulpdebug({title:'copy.js.local service worker files'})))
        .pipe(gulp.dest(Config.PROD_DEST));
};
开发者ID:GeoscienceAustralia,项目名称:gnss-site-manager,代码行数:17,代码来源:copy.js.local.prod.ts

示例7: buildTypeScript

function buildTypeScript() {
  typescriptCompiler = ts.createProject('tsconfig.json', {
    typescript: require('typescript')
  });
  let src = gulp.src(project.transpiler.source).pipe(changedInPlace({ firstPass: true }));
  return eventStream
    .merge(src)
    .pipe(plumber({ errorHandler: notify.onError('Error: <%= error.message %>') }))
    .pipe(typescriptCompiler())
    .pipe(gulpif(isJsFile, build.bundle()));
}
开发者ID:aurelia,项目名称:aurelia,代码行数:11,代码来源:transpile.ts

示例8: getOptimizeStreams

export function getOptimizeStreams(options?: OptimizeOptions):
    NodeJS.ReadWriteStream[] {
  options = options || {};
  const streams = [];

  streams.push(gulpif(matchesExt('.js'), new JsTransform(options)));
  streams.push(gulpif(matchesExt('.html'), new HtmlTransform(options)));

  if (options.css && options.css.minify) {
    streams.push(gulpif(
        matchesExtAndNotExcluded('.css', options.css.minify),
        new CSSMinifyTransform({stripWhitespace: true})));
    // TODO(fks): Remove this InlineCSSOptimizeTransform stream once CSS
    // is properly being isolated by splitHtml() & rejoinHtml().
    streams.push(gulpif(
        matchesExtAndNotExcluded('.html', options.css.minify),
        new InlineCSSOptimizeTransform({stripWhitespace: true})));
  }

  return streams;
}
开发者ID:MehdiRaash,项目名称:tools,代码行数:21,代码来源:optimize-streams.ts

示例9: flatten

  return new Promise<void>((resolve, reject) => {
    let destinationOptions: vfs.DestOptions;
    if (options && options.mode)
      destinationOptions = { mode: options.mode };

    gulp
      .src(sourcePatterns, options)
      .pipe(gulpif(options && options.flatten, flatten()))
      .pipe(gulp.dest(destination, destinationOptions))
      .on("end", resolve)
      .on("error", reject);
  });
开发者ID:spicypixel,项目名称:core-kit-js,代码行数:12,代码来源:index.ts

示例10: optimize

export function optimize(options?: OptimizeOptions) {
  let transforms = [];

  if (options) {
    if (options.js && options.js.minify) {
      transforms.push(new UglifyTransform());
    }
    if (options.css && options.css.stripWhitespace) {
      transforms.push(cssSlam());
    }
    if (options.html) {
      transforms.push(gulpif(/\.html$/, htmlmin(options.html)));
    }
  }
  return compose(transforms);
}
开发者ID:frankisans,项目名称:polymer-cli,代码行数:16,代码来源:optimize.ts


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