Search code examples
uglifyjs

is there a reason to not use an online uglifyjs minifier?


Is there any reason not to use an online uglifyjs program like http://skalman.github.io/UglifyJS-online/? Seems so much easier than installing it oneself.


Solution

  • There are some security implications - you're basically not only showing a random third party (and additional listeners if it's not over TLS) your whole code but also trusting the third party and any attacker not to insert malicious content.

    Additionally, the particular online service may be unreliable or be broken (hopefully in obvious ways of opposed to, say, only emitting the first 512 bytes). You're also out of luck if there is a routing problem on your end. Sometimes, it can also be quite slow - a local minification tool should be done within 0.1s, which is quite hard to do over the Internet, especially on a mobile connection.

    But most importantly, if configured correctly, using an online service interactively should be more, not less work. Good software can be built and published automatically. If your build process entails manually copying code, pasting it somewhere, and then copying back the result, that's a lot of wasted time.

    If you use a build process tool (like grunt or the venerable make), the minification can be done automatically, as one step in a large list.

    Additionally, navigating to a website is harder than to hit the build button.

    Finally, installation isn't that hard - have a look at the instructions.

    npm install uglify-js -g
    

    should be all you need.