本文整理汇总了TypeScript中gulp-uglify.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript gulp-uglify.default方法的具体用法?TypeScript gulp-uglify.default怎么用?TypeScript gulp-uglify.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gulp-uglify
的用法示例。
在下文中一共展示了gulp-uglify.default方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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'));
});
示例2: function
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()
})
})
}
示例3: 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;
}
示例4: pump
gulp.task('compress', (cb) => {
pump([
gulp.src('lib/*.js'),
uglify(),
gulp.dest('dist')
],
cb
);
});
示例5:
gulp.task('compress2', () => {
const tsResult = gulp.src('lib/*.ts')
.pipe(uglify({
mangle: false,
compress: false,
output: {
max_line_len: 300
}
}))
.pipe(gulp.dest('dist'));
});
示例6: 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'));
});
示例7: 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)));
}
示例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)))