javascript - Closure Compiler: How to separate and control compilation/minification passes? -
the google closure compiler powerful compiler , minifier js, gives lot of optimization options such renaming variables, removing dead codes, collapsing variable declarations, rewriting control flow structures , etc.
what want separately apply 1 or of these optimizations on input js program. example, may want rename variables short names, not remove dead codes. how can achieve kind of detailed compilation pass control? source code of cc expose specific interfaces customization, or should write own pass(if so, how supposed start?).
the command line features offer several options controlling compilation, insufficient fit want above. since source code kinda complicated , few detailed design documentation can found, stuck here. insights appreciated, :)
take @ defaultpassconfig. class lists passes run during compilation, based on options set in compileroptions. of compileroptions can controlled command line, try keep compiler relatively simple , easy use, , not ask users make decisions bunch of different compiler flags. plus, there passes increase code size, in such way makes easier later pass decrease afterwards.
of course if you're experimenting compiler or trying understand how works, can turn on , off whichever passes want, either adding new flags, or modifying defaultpassconfig directly.
Comments
Post a Comment