Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

UglifyJS filter ast_mangle #21

Open
outaTiME opened this Issue · 3 comments

2 participants

Ariel Falduto Joe Walker
Ariel Falduto

Hi guys,

seeing the source code i found something not compatible with UglifyJS documentation ...

source code says ...

copy.filter.uglifyjs = function(input) {
    if (typeof input !== 'string') {
        input = input.toString();
    }

    var opt = copy.filter.uglifyjs.options;
    var ast = ujs.parser.parse(input, opt.parse_strict_semicolons);

    if (opt.mangle) {
        ast = ujs.uglify.ast_mangle(ast, opt.mangle_toplevel);
    }

    if (opt.squeeze) {
        ast = ujs.uglify.ast_squeeze(ast, opt.squeeze_options);
        if (opt.squeeze_more) {
            ast = ujs.uglify.ast_squeeze_more(ast);
        }
    }

    return ujs.uglify.gen_code(ast, opt.beautify);
};

but the "ast_mangle" method will be need this way (not boolean value):

ast_mangle(ast, options)

where the options will be:

  • toplevel – mangle toplevel names (by default we don’t touch them).
  • except – an array of names to exclude from compression.
  • defines – an object with properties named after symbols to replace.

checkout:

https://github.com/mishoo/UglifyJS/blob/master/README.org

thks, asssssssom ... lib!

Ariel Falduto

The same happens with gen_code method.

pro.gen_code(ast, options)

where the options are:

  • beautify: false – pass true if you want indented output
  • indent_start: 0 (only applies when beautify is true) – initial indentation in spaces
  • indent_level: 4 (only applies when beautify is true) – indentation level, in spaces (pass an even number)
  • quote_keys: false – if you pass true it will quote all keys in literal objects
  • space_colon: false (only applies when beautify is true) – wether to put a space before the colon in object literals
  • ascii_only: false – pass true if you want to encode non-ASCII characters as \uXXXX.
  • inline_script: false – pass true to escape occurrences of </script in strings

thks, again !

Joe Walker
Owner

I wonder if Uglify changed.
From what I can see this works for me though. Is it causing you errors?

Ariel Falduto

nope, code works fine ... its only a comment to be aligned to Uglify interface ...

and it will be great to override the:

copy.filter.uglifyjs.options

proper,

thks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.