Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including cordova-uglify with all npm packages installed. Try it out:

cordova-uglify lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

require("yuicompressor/package.json"); // yuicompressor is a peer dependency. // require("cordova-uglify/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

cordova-uglify v0.0.5

Cordova hook that allows you to uglify or minify your apps JavaScript and CSS.


Cordova hook that allows you to uglify or minify your apps JavaScript and CSS.


Install the following package below inside of your apps root folder.

npm install cordova-uglify

Open the node_modules/cordova-uglify folder that is added and copy the after_prepare folder to your Cordova hooks folder in your apps root folder.


Once you have this hook installed it will compress your apps JavaScript and CSS when you run a cordova prepare <platform> or cordova build <platform> command. This hook does not change your assets that live in the root www folder; it will uglify the assets that get output to the platforms folder after a prepare or build. Take a look at this line in the hook to add more files to be minified if you want. By default the hook will uglify the JavaScript and CSS in the <platform> www/js and www/css of your project.


Out of the box this hook requires Cordova 3.3.1-0.4.2 but it can work with versions 3.0.0 thru 3.3.0 if you manually indicate the path for the platforms directories on Android and iOS. This is becuase the CORDOVA_PLATFORMS environment variable was not added until version 3.3.1-0.4.2 (see this post by Dan Moore).

I came across a quirk on Linux where the hooks folder needs to have permissions modified. Perform a chmod -R 755 /hooks to resolve this issue.



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free