简体   繁体   中英

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

Google Closure Compiler does it with ADVANCED_OPTIMIZATIONS option, but I can not use it, since I use jQuery. So, I have to use SIMPLE_OPTIMIZATIONS, but I would like to compress names of some functions.

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

myLongFunctionName(text);

I am OK to have myLongFunctionName changed to a (or whatever Closure Compiler chooses). But I don't see any annotation , which could help me. How could I do it?

If function is local, then Google Closure Compiler renames it. I've moved my code into

(function(){

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

  myLongFunctionName(text);

})()

In result, it is compressed also.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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