Giter VIP home page Giter VIP logo

react-native-static-images's Introduction

react-native-static-images

npm version

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 quotation

Full 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");
}

react-native-static-images's People

Contributors

wcandillon avatar zubko avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.