javascript - UglifyJS property mangling - Stack Overflow

According to the docs, UglifyJS can mangle all property names except those on a provided reserved list.

According to the docs, UglifyJS can mangle all property names except those on a provided reserved list. Is it possible to do it the other way, so only properties on provided list will be mangled?

If so, what options do I need to pass to uglify.minify(files, { ... })?

According to the docs, UglifyJS can mangle all property names except those on a provided reserved list. Is it possible to do it the other way, so only properties on provided list will be mangled?

If so, what options do I need to pass to uglify.minify(files, { ... })?

Share Improve this question asked Jun 15, 2015 at 8:47 Sebastian NowakSebastian Nowak 5,7179 gold badges70 silver badges111 bronze badges 1
  • 2 it seems such option is not supported so you would need to modify source code. – artur grzesiak Commented Jun 28, 2015 at 20:58
Add a ment  | 

1 Answer 1

Reset to default 9 +50

One (ugly) mand-line approach to achieve the kind of whitelist you're looking for might be to use the regex option.

You can also use a regular expression to define which property names should be mangled. For example, --mangle-regex="/^_/" will only mangle property names that start with an underscore.

UglifyJS2 Readme

Otherwise, there is an open issue which provides the code you could use to modify uglify yourself which achieves what I believe you're looking for.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742269897a4412500.html

相关推荐

  • javascript - UglifyJS property mangling - Stack Overflow

    According to the docs, UglifyJS can mangle all property names except those on a provided reserved list.

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信