Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define option incorrectly documented #75

Closed
jneuendorf opened this issue Sep 30, 2014 · 1 comment
Closed

define option incorrectly documented #75

jneuendorf opened this issue Sep 30, 2014 · 1 comment

Comments

@jneuendorf
Copy link

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)

@lautis
Copy link
Owner

lautis commented Sep 30, 2014

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.

@lautis lautis closed this as completed Jan 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants