本文介绍了除了用gulp-uglify之外的所有变量,将其混为一谈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以用gulp-uglify处理除特定变量以外的所有变量?

Is there a way to mangle all variables except a specific one with gulp-uglify?

推荐答案

肯定有,我找不到 gulp-uglify 关于这些子选项,因此依赖 grunt-uglify &是用 gulp 方式写的.

There definitely is, I couldn't find any documentation for gulp-uglify regarding these sub-options, so relied on grunt-uglify & wrote it the gulp way.

.pipe( uglify({ mangle: {except: ['jQuery']} }) ) // for gulp-uglify ^2.0.1

上面的代码将破坏每个变量除外 jQuery

The above code will mangle every variable except jQuery

希望这对您仍然有用. ;)

Hopefully this will still be useful for you. ;)

山姆.

========

注意事项:如果您使用的是gulp-uglify ^3.0.0,请用reserved替换except,例如:

NB: If you are using gulp-uglify ^3.0.0 please replace except with reserved eg:

.pipe( uglify({ mangle: {reserved: ['jQuery']} }) ) // for gulp-uglify ^3.0.0

Lukas Winkler

这篇关于除了用gulp-uglify之外的所有变量,将其混为一谈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 20:19