react-native-smart-assets icon indicating copy to clipboard operation
react-native-smart-assets copied to clipboard

✅ Automatically generate an Images module from your image assets. Converts intelligently (e.g. PDF to @2x, @3x etc).

react-native-smart-assets

Automatically generate an Images module from your image assets. Converts intelligently (e.g. PDF to @2x, @3x etc).

---Automatically-->

import Images from './Images';

...

<Image source={Images.myIcon} /> // Property name is same as file name. Automatically uses @2x, @3x.

Requirements

  • Mac OS X or Linux.
  • GhostScript is required to convert PDF assets into pre-rendered PNGs for different DPIs. Mac OS X users can use brew install gs.

Usage

./convert-assets.sh /assets_directory /output_directory

A directory named img and a script named Images.js will be added to the output directory. Existing ones will be removed.