Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-res

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-res

This tool will crop and resize PNG source images into appropriate sizes for modern iOS and Android devices.

  • 0.6.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15K
decreased by-4.27%
Maintainers
1
Weekly downloads
 
Created
Source

Resource Generator

This tool will crop and resize JPEG and PNG source images to generate images for modern iOS and Android devices.

cordova-res must run at the root of a Cordova project, such as:

resources/
├── icon.png
└── splash.png
config.xml
  • resources/icon.png must be at least 1024×1024px
  • resources/splash.png must be at least 2732×2732px

Android Adaptive Icons are also supported. If you choose to use them, create the following additional file(s):

  • resources/android/icon-foreground.png must be at least 432×432px
  • resources/android/icon-background.png must be at least 432×432px

If adaptive icons are used, regular Android icons are not generated.

A color may also be used for the icon background by specifying the --icon-background-source option with a hex color code, e.g. --icon-background-source '#FFFFFF'.

Install

$ npm install -g cordova-res

Usage

See the help documentation on the command line with the --help option.

$ cordova-res --help

Programmatic API

cordova-res can be used programmatically.

CommonJS Example
const run = require('cordova-res');

await run();
TypeScript Example

run() takes an options object described by the interface Options. If options are provided, resources are generated in an explicit, opt-in manner. In the following example, only Android icons and iOS splash screens are generated.

import { Options, run } from 'cordova-res';

const options: Options = {
  directory: '/path/to/project',
  resourcesDirectory: 'resources',
  logstream: process.stdout, // Any WritableStream
  platforms: {
    android: { icon: { sources: ['resources/icon.png'] } },
    ios: { splash: { sources: ['resources/splash.png'] } },
  },
};

await run(options);

Keywords

FAQs

Package last updated on 09 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc