minify - Statistics on renaming via JavaScript minifier -


i new minification of javascript. setting of problem:

assuming have original javascript code , minified code a′ (which generated minifier uglifyjs or closure compiler), how can i:

  1. count number of variables have been renamed, ,

  2. map every variable's original name minified name

any detailed instructions welcomed, tool uglifyjs or closure compiler better :)

there 2 approaches:

1) closure compiler can produce "renaming map" both properties , variables. map not include unrenamed variables there still work do. see --variable_renaming_report command-line option https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/commandlinerunner.java#l215.

2) closure compiler , other tools produce source maps. source map can used map every byte original character in original.

for second closure compiler project includes java library reading source maps: https://github.com/google/closure-compiler/blob/master/src/com/google/debugging/sourcemap/sourcemapconsumerv3.java#l225

there exist javascript source map utilities: https://github.com/mozilla/source-map/


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -