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


TypeScript vinyl-buffer類代碼示例

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


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

示例1: getBrowserCodeStream

export function getBrowserCodeStream(appName: string, opts?: PrebootOptions): any {
  opts = normalize(opts);

  let bOpts = {
    entries: [__dirname + '/../browser/preboot_browser.js'],
    standalone: 'preboot',
    basedir: __dirname + '/../browser',
    browserField: false
  };
  let b = browserify(bOpts);

  // ignore any strategies that are not being used
  ignoreUnusedStrategies(b, bOpts, opts.listen, listenStrategies, './listen/listen_by_');
  ignoreUnusedStrategies(b, bOpts, opts.replay, replayStrategies, './replay/replay_after_');

  if (opts.freeze) {
    ignoreUnusedStrategies(b, bOpts, [opts.freeze], freezeStrategies, './freeze/freeze_with_');
  }

  // ignore other code not being used
  if (!opts.buffer) { b.ignore('./buffer_manager.js', bOpts); }
  if (!opts.debug) { b.ignore('./log.js', bOpts); }

  // use gulp to get the stream with the custom preboot browser code
  let outputStream = b.bundle()
    .pipe(source('src/browser/preboot_browser.js'))
    .pipe(buffer())
    .pipe(insert.append('\n\n;preboot.init("' + appName + '",' + stringifyWithFunctions(opts) + ');\n\n'))
    .pipe(insert.append('\n\n;preboot.init("' + appName + '2",' + stringifyWithFunctions(opts) + ');\n\n'))
    .pipe(rename('preboot.js'));

  // uglify if the option is passed in
  return opts.uglify ? outputStream.pipe(uglify()) : outputStream;
}
開發者ID:StevenLudwig,項目名稱:universal,代碼行數:34,代碼來源:browser_code_generator.ts

示例2: browserify

 let bundleApp = () => {
   return browserify(join(TMP_DIR, 'main'))
     .bundle()
     .pipe(vinylSourceStream(JS_PROD_APP_BUNDLE))
     .pipe(vinylBuffer())
     // Strip comments and sourcemaps
     .pipe(plugins.uglify({
       mangle: true,
       compress: true,
       preserveComments: 'license'
     }))
     .pipe(gulp.dest(JS_DEST));
 };
開發者ID:ouq77,項目名稱:portfolio-web,代碼行數:13,代碼來源:build.bundles.ts


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