generate-cordova-assets

2.0.7 • Public • Published

generate-cordova-assets

NPM version build status Downloads

Automatically generate assets for a Cordova based project.

This provides a Cordova hook which can automatically generate icons and splash screens from a single source.

Installation

npm install generate-cordova-assets --save-dev

Usage

Cordova Hook

This project comes with a Cordova hook that generates pixel perfect icons and splash screens from one icon.

This is best put in the after_prepare hook. This means that the hook will overwrite images after Cordova has copied its default images.

For more info, see the Cordova documentation about icons and splash screens.

Preference configuration options

Name Description
IconSource The source icon to read.
IconBackgroundColor The color to use to fill the color for images that may not be transparent.

Example

Add the following configurations to the config.xml file in your Cordova project:

<preference name="IconSource" value="www/icon.svg"/>
<preference name="IconBackgroundColor" value="#eeeeee"/>
 
<hook type="after_prepare" src="node_modules/generate-cordova-assets/hook.js"/>

CLI Tool

The CLI tool may be used to convert an icon to an output icon of a given width, height and background color. This may be useful to create assets for uploading to Google Play or the App Store.

For options, run:

./node_modules/.bin/process-icon --help

NodeJS

The NodeJS API may be used. However, it is not the main API and it is not guaranteed to stay the same in the forseeable future.

FAQ

Why not any of the other hooks on npm?

The other hooks I found don't support SVG or splash screens or require extra configurations.

Why are legacy launch images used for iOS?

There are two methods of defining splash images docs.

  1. Legacy launch images.
  2. Launch storyboard images.

Cordova defaults to the legacy launch images, when nothing is specified in config.xml.

Readme

Keywords

none

Package Sidebar

Install

npm i generate-cordova-assets

Weekly Downloads

0

Version

2.0.7

License

MIT

Last publish

Collaborators

  • remcohaszing