diff --git a/README.md b/README.md index 0958ca9..0daf59d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # splashicon-generator -Automatic icon and splash screen resizing for PhoneGap. Create an icon in the root folder of your PhoneGap project and use ```icon.png``` and a ```splash.png``` to automatically resize and copy it for all the platforms your project supports (currently works with **iOS**, **Android** and **Windows Phone 8**). +Automatic icon and splash screen resizing for any **Cordova** based applications including **PhoneGap**. It uses an ```icon.png``` and a ```splash.png``` to automatically resize and copy it for all the platforms your project supports (currently works with **iOS**, **Android** and **Windows Phone 8**). Consider using the base icon and splash images in the `model` folder, so that images are not cropped and resized incorrectly. @@ -44,78 +44,162 @@ On windows see http://www.imagemagick.org/script/binary-releases.php#windows --- -### Configuring icons +### Configuring icons for Cordova project Include in your ```config.xml``` file: ```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ``` --- -### Configuring splash +### Configuring splash for Cordova project Include in your ```config.xml``` file: ```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +--- + +### Configuring splash and icon for PhoneGap project + +You can use the same configuration of an cordova project just adjusting the xml elements as their documentation says: + +[http://docs.phonegap.com/phonegap-build/configuring/icons-and-splash/](http://docs.phonegap.com/phonegap-build/configuring/icons-and-splash/) + +--- + +### Generate custom assets + +You can use this package under node to specify custom assets. I personally use this for adding a custom Icon for Push on android. That needs to be an icon with transparency. +I use it with gulp like this: + +```js +var splashiconGenerator = require("splashicon-generator"); + +gulp.task('generate-splashicon', function(done) { + // Generate all the default assets + splashiconGenerator.generate() + .then(function() { + + // Configure the custom assets with their sizes + var options = { + ICON_FILE: path.join('model', 'pushicon.png'), + SPLASH_FILE: '', // ignore plash generation + ICON_PLATFORMS: [{ + name: 'android-push-icon', + iconsPath: 'res/icons/android/', + isAdded: true, + icons: [ + { name: 'push-icon-36-ldpi.png', size: 36, density: 'ldpi' }, + { name: 'push-icon-48-mdpi.png', size: 48, density: 'mdpi' }, + { name: 'push-icon-72-hdpi.png', size: 72, density: 'hdpi' }, + { name: 'push-icon-96-xhdpi.png', size: 96, density: 'xhdpi' }, + { name: 'push-icon-144-xxhdpi.png', size: 144, density: 'xxhdpi' }, + { name: 'push-icon-192-xxxhdpi.png', size: 192, density: 'xxxhdpi' } + ] + }] + }; + // Generate only the custom assets specified in the `options` parameter + splashiconGenerator.generate(options).then(function() { + done(); + }); + }); +}); +``` + +Then just add it to the `config.xml`: + +```xml + + + + + + + + + ``` --- diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..7f77f59 Binary files /dev/null and b/icon.png differ diff --git a/index.js b/index.js index 28f1f4b..1704069 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,5 @@ var fs = require('fs'); var path = require('path'); -var xml2js = require('xml2js'); var ig = require('imagemagick'); var colors = require('colors'); var _ = require('underscore'); diff --git a/package.json b/package.json index 7743765..e7ad938 100644 --- a/package.json +++ b/package.json @@ -1,46 +1,47 @@ { - "name": "splashicon-generator", - "version": "0.2.7", - "description": "Automatic icon & splash resizing for PhoneGap", - "main": "index.js", - "preferGlobal": "false", - "bin": { - "splashicon-generator": "./bin/splashicon-generator" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git://github.com/eberlitz/splashicon-generator.git" - }, - "keywords": [ - "cordova", - "phonegap", - "icon", - "splash", - "resize" - ], - "author": { - "name": "Eduardo Eidelwein Berlitz", - "email": "eberlitz@gmail.com" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/eberlitz/splashicon-generator/issues" - }, - "homepage": "https://github.com/eberlitz/splashicon-generator", - "dependencies": { - "colors": "^0.6.2", - "imagemagick": "^0.1.3", - "node-fs": "^0.1.7", - "q": "^1.0.1", - "underscore": "^1.6.0", - "xml2js": "^0.4.3", - "yargs": "^3.8.0" - }, - "contributors": [{ - "name": "Luiz Pereira de Souza Filho", - "email": "lpsouza@gmail.com" - }] + "name": "splashicon-generator", + "version": "0.2.8", + "description": "Automatic icon & splash resizing for PhoneGap", + "main": "index.js", + "preferGlobal": false, + "bin": { + "splashicon-generator": "./bin/splashicon-generator" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git://github.com/eberlitz/splashicon-generator.git" + }, + "keywords": [ + "cordova", + "phonegap", + "icon", + "splash", + "resize" + ], + "author": { + "name": "Eduardo Eidelwein Berlitz", + "email": "eberlitz@gmail.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/eberlitz/splashicon-generator/issues" + }, + "homepage": "https://github.com/eberlitz/splashicon-generator", + "dependencies": { + "colors": "^0.6.2", + "imagemagick": "^0.1.3", + "node-fs": "^0.1.7", + "q": "^1.0.1", + "underscore": "^1.6.0", + "yargs": "^3.8.0" + }, + "contributors": [ + { + "name": "Luiz Pereira de Souza Filho", + "email": "lpsouza@gmail.com" + } + ] } \ No newline at end of file