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:
count number of variables have been renamed, ,
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
Post a Comment