# cordova-icon

> Automatic icon resizing for Cordova

Latest version **1.0.0** (published 2018-02-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install cordova-icon
pnpm add cordova-icon
yarn add cordova-icon
bun add cordova-icon
```

Provides the command `cordova-icon`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-02-09 |
| First published | 2014-05-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 27.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 683 |
| Author | Alex Disler |
| Maintainers | alex101 |
| Keywords | cordova, icon, resize |

## Links

- npm: https://www.npmjs.com/package/cordova-icon
- Repository: https://github.com/AlexDisler/cordova-icon
- Issues: https://github.com/AlexDisler/cordova-icon/issues
- npm.io page: https://npm.io/package/cordova-icon

## Dependencies (7)

- [q](https://npm.io/package/q.md) ^1.0.1
- [colors](https://npm.io/package/colors.md) ^0.6.2
- [xml2js](https://npm.io/package/xml2js.md) ^0.4.3
- [fs-extra](https://npm.io/package/fs-extra.md) ^0.30.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [underscore](https://npm.io/package/underscore.md) ^1.6.0
- [imagemagick](https://npm.io/package/imagemagick.md) ^0.1.3

## Alternatives

- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) — 2.2M weekly downloads
- [roboto-fontface](https://npm.io/package/roboto-fontface.md) — 196.0K weekly downloads
- [@react-native-vector-icons/common](https://npm.io/package/@react-native-vector-icons/common.md) — 150.4K weekly downloads
- [@procore/core-icons](https://npm.io/package/@procore/core-icons.md) — 4.6K weekly downloads
- [@react-md/material-icons](https://npm.io/package/@react-md/material-icons.md) — 1.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-02-09
- 0.13.0 — 2018-02-07
- 0.12.0 — 2018-02-06
- 0.11.0 — 2017-10-24
- 0.10.0 — 2017-09-22
- 0.9.1 — 2016-11-14
- 0.9.0 — 2016-08-25
- 0.8.0 — 2016-08-19
- 0.7.0 — 2016-03-24
- 0.6.0 — 2016-03-11
- 0.5.0 — 2016-03-04
- 0.4.1 — 2016-02-29
- 0.4.0 — 2016-02-19
- 0.3.0 — 2015-06-16
- 0.2.0 — 2014-11-10
- … 5 more at https://npm.io/package/cordova-icon/versions

## README

# cordova-icon

<img src="cordova-icon-resize.png"/>

Automatic icon resizing for Cordova. Create an icon in the root folder of your Cordova project and use cordova-icon to automatically resize and copy it for all the platforms your project supports (currenty works with iOS, Android, Windows 10 and OSX).

### Installation

```bash
$ sudo apt-get install imagemagick
$ # on Mac: brew install imagemagick
$ # on Windows: http://www.imagemagick.org/script/binary-releases.php#windows (check "Legacy tools")

$ sudo npm install cordova-icon -g
```
If you are using an older version of cordova (before 7.x):

```bash
$ sudo npm install cordova-icon@0.13.0 -g
```

### Requirements

- **ImageMagick installed**
- At least one platform was added to your project ([cordova platforms docs](http://cordova.apache.org/docs/en/edge/guide_platforms_index.md.html#Platform%20Guides))
- Cordova's config.xml file must exist in the root folder ([cordova config.xml docs](http://cordova.apache.org/docs/en/edge/config_ref_index.md.html#The%20config.xml%20File))

### Usage

Create an `icon.png` file in the root folder of your cordova project.
You can provide a platform-specific icon by naming it `icon-[platform].png`
(e.g `icon-android.png`, `icon-ios.png`).
Then run:

     $ cordova-icon

You also can specify manually a location for your `config.xml` or `icon.png`:

     $ cordova-icon --config=config.xml --icon=icon.png

If you run a old version of Cordova for iOS / Mac and you need your files in `/Resources/icons/`, use this option:

     $ cordova-icon --xcode-old

For good results, your file should be:

- square
- for Android and iOS, at least 1024\*1024px
- for Windows, at least 1240\*1240px

#### Notes:

- Your `config.ml` file will not be updated by the tool (because images are automatically created in the good folders)
- Therefore, in your `config.xml`, be sure to remove all lines looking like `<icon src="res/android/ldpi.png" density="ldpi" />`

### Creating a cordova-cli hook

Since the execution of cordova-icon is pretty fast, you can add it as a cordova-cli hook to execute before every build.
To create a new hook, go to your cordova project and run:

    $ mkdir hooks/after_prepare
    $ vi hooks/after_prepare/cordova-icon.sh

Paste the following into the hook script:

    #!/bin/bash
    cordova-icon

Then give the script +x permission:

    $ chmod +x hooks/after_prepare/cordova-icon.sh

That's it. Now every time you `cordova build`, the icons will be auto generated.

### Splash screens

Check out [cordova-splash](https://github.com/AlexDisler/cordova-splash)

### More

- [cordova-plugin-inapppurchase](https://github.com/AlexDisler/cordova-plugin-inapppurchase) - a lightweight cordova plugin for in app purchases on iOS/Android
- [ng-special-offer](https://github.com/AlexDisler/ng-special-offer) - prompt users to rate your cordova app in the app store
- [ionic-lock-screen](https://github.com/AlexDisler/ionic-lock-screen) - passcode lock screen for ionic (with touch id support for iOS)
- [ionic-zoom-view](https://github.com/AlexDisler/ionic-zoom-view) - an easy way to add a zoom view to images using an ionic modal
- [ng-persist](https://github.com/AlexDisler/ng-persist) - store data on mobile devices (using cordova) that persists even if the user reinstalls the app

### License

MIT

---
_Source: https://npm.io/package/cordova-icon · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
