Minifying of output (javascript)

Hello guy,
I try to do minify of my javascript output but I failed.
Please can you show me on real example how to use in haxe for example Uglify compression (Tag: minify) ?
I am doing build by haxe build.hxml :

-cp src
-main Main
-js js/main.js
-dce full

Thank you

uglifyjs (1.0.0) has a readme with exactly what you need to do.

Once uglifyjs is installed with haxelib install uglifyjs you need to add -lib uglifyjs to your build.hxml.

Same for closure (0.3.1) haxelib install closure and -lib closure.

Both have options you can activate by adding a define to your hxml.

Sure, i add it to my build.hxml to my example above but not working. I can’t answer why. I am still getting error: “sh: uglifyjs: command not found” after compiling and I have it installed.

Please read the readme of the library. You also need to install the npm module.

Thanks, finally got it :slight_smile:

1 Like