Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wcandillon/react-native-static-images
Generate a file for static images for react native projects
https://github.com/wcandillon/react-native-static-images
Last synced: 2 months ago
JSON representation
Generate a file for static images for react native projects
- Host: GitHub
- URL: https://github.com/wcandillon/react-native-static-images
- Owner: wcandillon
- License: apache-2.0
- Created: 2016-12-21T17:57:28.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-03T14:16:33.000Z (over 7 years ago)
- Last Synced: 2024-10-08T17:58:07.268Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 21
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-static-images
[![npm version](https://badge.fury.io/js/react-native-static-images.svg)](https://badge.fury.io/js/react-native-static-images)Generate a file for using static images in react native.
## Install
```
npm install react-native-static-images --save-dev
```## Usage
```
$(npm bin)/generate-images path/to/images --prefix ../ > src/Images.ts
```
Additional keys:| Key | Description | Default |
| --- | --- | --- |
| --js | generate JavaScript code | TypeScript |
| --flow | add @flow comment, (--js key is assumed implicitly) | TypeScript |
| --indent (count) | number of spaces to use for indentation | 4 |
| --singlequote | use single quotation marks | double quotationFull example:
```
$(npm bin)/generate-images path/to/images --prefix ../ --js --indent 2 > src/Images.js
```## Example
```
$ ls public/images/
ResetPassword.jpg SignIn.jpg SignUp.jpg challenges movements no-profile-pic.jpg selfie.jpg
$ $(npm bin)/generate-images public/images --prefix ../ > src/Images.ts
$ cat src/Images.ts
export default class Images {
static readonly resetPassword = require("../public/images/ResetPassword.jpg");
static readonly signIn = require("../public/images/SignIn.jpg");
static readonly signUp = require("../public/images/SignUp.jpg");
static readonly challengesLegflowPicture = require("../public/images/challenges/legflow/picture.jpg");
static readonly challengesLegflowThumbnail = require("../public/images/challenges/legflow/thumbnail.jpg");
static readonly movementsPauseThumbnail = require("../public/images/movements/pause/thumbnail.jpg");
static readonly movementsPushUpsThumbnail = require("../public/images/movements/push-ups/thumbnail.jpg");
static readonly movementsSquatHoldThumbnail = require("../public/images/movements/squat-hold/thumbnail.jpg");
static readonly movementsSquatJumpsThumbnail = require("../public/images/movements/squat-jumps/thumbnail.jpg");
static readonly noProfilePic = require("../public/images/no-profile-pic.jpg");
static readonly selfie = require("../public/images/selfie.jpg");
}
```