當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。