繁体   English   中英

如何在简单模式下告诉Google Closure Compiler可以压缩特定的函数名称?

[英]How to tell Google Closure Compiler in simple mode that particular function name could be compressed?

Google Closure Compiler使用ADVANCED_OPTIMIZATIONS选项实现了此功能,但由于使用jQuery,因此无法使用。 因此,我必须使用SIMPLE_OPTIMIZATIONS,但是我想压缩某些函数的名称。

function myLongFunctionName(response) {
 // do something here
}

myLongFunctionName(text);

我行有myLongFunctionName变为a (或任何使用Closure Compiler选择)。 但是我没有看到任何注释 ,它可以帮助我。 我该怎么办?

如果函数是本地函数,则Google Closure Compiler重命名它。 我已将代码移入

(function(){

  function myLongFunctionName(response) {
   // do something here
  }

  myLongFunctionName(text);

})()

结果,它也被压缩。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM