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


TypeScript gulp-uglify类代码示例

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


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

gulp.task('compress', (cb) => {
    pump([
            gulp.src('lib/*.js'),
            uglify(),
            gulp.dest('dist')
        ],
        cb
    );
});
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:9,代码来源:gulp-uglify-tests.ts

示例3: filter

gulp.task('default', () => {
    // create filter instance inside task function
    const f = filter(['*', '!src/vendor']);

    return gulp.src('src/*.js')
        // filter a subset of the files
        .pipe(f)
        // run them through a plugin
        .pipe(uglify())
        .pipe(gulp.dest('dist'));
});
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:11,代码来源:gulp-filter-tests.ts

示例4:

gulp.task('compress2', () => {
    const tsResult = gulp.src('lib/*.ts')
        .pipe(uglify({
            mangle: false,
            compress: false,
            output: {
                max_line_len: 300
            }
        }))
        .pipe(gulp.dest('dist'));
});
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:11,代码来源:gulp-uglify-tests.ts

示例5: function

gulp.task('compress2', function() {
    var tsResult = gulp.src('lib/*.ts')
        .pipe(uglify({
            mangle: false,
            preserverComments: "some",
            compress: false,
            output: {
                max_line_len: 300
            }
        }))
        .pipe(gulp.dest('dist'));
});
开发者ID:0815fox,项目名称:DefinitelyTyped,代码行数:12,代码来源:gulp-uglify-tests.ts

示例6: build

function build(
	buildDir: string,
	minifyScripts: boolean,
	bundleScripts: boolean,
	embedSourceMap: boolean,
	separateBuildDir: boolean
): Promise<void> {

	return sourceMapUtil.waitForStreamEnd(
		gulp.src(path.join(buildDir, separateBuildDir ? '../src/*.js' : '*.js'))
		.pipe(sourcemaps.init())
		.pipe(minifyScripts ? uglify({ mangle: false, compress: { sequences: false } }) : nop())
		.pipe(bundleScripts ? concat('bundle.js') : rename((path) => { path.basename += '.min'; }))
		.pipe(mapSources((srcPath) => separateBuildDir ? '../src/' + srcPath : srcPath))
		.pipe(sourcemaps.write(embedSourceMap ? undefined : '.', { includeContent: false }))
		.pipe(gulp.dest(buildDir)));
}
开发者ID:hbenl,项目名称:vscode-firefox-debug,代码行数:17,代码来源:testGulpSourceMaps.ts

示例7: buildBundle

export default async function (env: string, target: string, callback?: Function) {
  await buildBundle(env, target)

  const config = require(`../../config/${env}.json`)
  const cdnPrefix = `https://dn-st.teambition.net/${config.cdnNames[target]}`
  const revall = new RevAll({
    prefix: cdnPrefix,
    dontGlobal: [/\/favicon\.ico$/],
    dontRenameFile: [/\.html$/],
    dontUpdateReference: [/\.html$/],
    dontSearchFile: [/lib.js/, /images/]
  })

  const stream = merge2([
    gulp.src([
      `www/index.html`,
      `www/fonts/**`,
      `www/images/**`
    ]),
    gulp.src([
      `www/js/**`
    ])
      .pipe(stripDebug())
      .pipe(uglify())
      .pipe(greplace('/weixin/dev/signature', '/weixin/signature'))
      .pipe(greplace('/weixin/dev/tpl/message', '/weixin/tpl/message'))
      .pipe(greplace('http://"+window.location.host+"/images/teambition.png', '/images/teambition.png'))
      .pipe(greplace('/weixin/dev/', '/weixin/')),
    gulp.src([
      `www/css/**`
    ]).pipe(cssNano({rebase: false})),
  ])
    .pipe(revall.revision())
    .pipe(gulp.dest(`dist`), callback)

  return new Promise((resolve, reject) => {
    stream.on('end', async function() {
      resolve()
    })
  })
}
开发者ID:jianxc,项目名称:teambition-mobile-web,代码行数:41,代码来源:release.ts

示例8: uglify

gulp.task('jsLib', () => gulp.src(PATHS.src.vendor.js)
  .pipe(gulpIf(IS_PROD, sourcemaps.init()))
  .pipe(gulpIf(IS_PROD, uglify({ mangle: false })))
  .pipe(gulpIf(IS_PROD, sourcemaps.write()))
  .pipe(gulp.dest((file: any) => mapDestPathForlib(file.path)))
开发者ID:brunkb,项目名称:a2-contact,代码行数:5,代码来源:gulpfile.ts


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