Closed jneuendorf closed 9 years ago
The following code works for me with latest Uglifier
Uglifier.compile("var a = STR", {define: {STR: "foo"}})
# => "var a=\"foo\";"
You could use compress hash too, but then the argument would need to be global_defs
Uglifier.compile("var a = STR", compress: {global_defs: {STR: "foo"}})
If you have an example that should work but doesn't, let me know and I'll update the documentation accordingly.
Hey,
I wanted to use the define option to replace a debug variable but it didn't work. After I tried around a bit I got it working after I put the
:define => { "DEBUG" => false }
into the:compress
hash it worked. So apparently this option has to be defined in that hash instead of the top level (of all options) so the listed options aren't quite correct, I guess (https://github.com/lautis/uglifier -> Usage)