phonegap-assets

2.2.1 • Public • Published

phonegap-assets

This tool will take an image (1024*1024[min]) then generate a set of appropriate sizes icons for your Phonegap project. Also it creates splash screen images as well.

Major change in V.2

As of Version 2, the phonegap-assets becomes an interactive command line program. All the previous options will no longer apply.

And the core action that generate icon and splash now in two different command line program, phonegap-assets-icon and phonegap-assets-splash.

And since the creation of this tool, the landscape of mobile world has changed a lot. Now we only got two platforms left (well, sort of but many news things on the horizon like Harmony). And cordova / phonegap once again making breaking change to their config.xml. Instead of taking the config.xml we use a stock template (which include all the names and their sizes) as a map to generate icons and splash for you.

Installation

It's recommended to install this globally

$ npm install phonegap-assets --global

phonegap-assets

Just run it from command line:

$ phonegap-assets

Answer the questions (it will try to detect files it expects and fill out the default). And by the end you should have you icons / splash screen files.s

phonegap-assets-icons

This one will only generate icons for ios / android (round / square). It uses a stock config.xml file and use the sizes and name information. If you use the default options, you will end up with two folders (ios/android) of resized images from your source icon file.

How to use it

$ phonegap-assets-icons /path/to/your/icon.png

It expects a square png images no smaller then 1024x1024.

Then on the same place where you execute this command, you will get two folders of images

options

  • dest (-d) where you want to put the generated images
  • platform(-p) you can specify just one type of images (ios/android)
  • round (-r) you can pass a float number to fine tune the round, default is 0.0833

phonegap-assets-splash

More or less the same like phonegap-assets-splash

$ phonegap-assets-icons /path/to/your/splash.png /path/to/where/you/export

Options are almost identical to phonegap-assets-icon except there is no round option.

Using it programmatically with assetsGeneratorApi (V2.2)

You can include this method in your program:

const { assetsGeneratorApi } = require('phonegap-assets')

assetsGeneratorApi(type, inputObj, outputObj)
    .then(result => {
        // do your things with your result 
    })

assetsGeneratorApi parameters

  • type (string) - "icon" or "splash"
  • inputObj (object) - expected keys are: 'sourceFile' (required), 'type'
  • outputObj (object) - expected keys are: 'destDir', 'quality', 'round', 'platform', 'flat'

And it will return a promise resolve the result array of output, or error when fail.


MIT (c) 2020 Joel Chu

Package Sidebar

Install

npm i phonegap-assets

Weekly Downloads

0

Version

2.2.1

License

MIT

Unpacked Size

91.3 kB

Total Files

31

Last publish

Collaborators

  • joelchu