Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to auto-generate externs for the Google Closure Compiler

Suppose you are working in a javascript project with several external library dependencies, and want to compile your sources using the Google Closure Compiler in ADVANCED_OPTIMIZATIONS mode.

Since in this mode the compiler will rename your code calls to the external libraries objects and functions, you must provide externs, to prevent this renaming from happening.

But, it is a lot of work to produce the externs by hand, so, what is the best way to auto-generate the appropriate extern from a given javascript lib?

like image 997
ivo Avatar asked Nov 24 '10 13:11

ivo


1 Answers

See the following URL as a starting point. I would also recommend adding type information to your externs to maximize compiler benefit.

http://www.dotnetwise.com/Code/Externs/

like image 168
Derek Slager Avatar answered Oct 21 '22 21:10

Derek Slager