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:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
Install the following package below inside of your apps root folder.
npm install cordova-uglify
node_modules/cordova-uglify folder that is added and copy the
after_prepare folder to your Cordova
hooks folder in your apps root folder.
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
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.