Giter VIP home page Giter VIP logo

react-native-asset's Introduction

react-native-asset

npm versionBuild Status

Link and unlink assets to your react-native project with ease!

Advantages

  • react-native link only supports font files, this tool supports all assets.
  • Unlinking is automatic when you delete an asset, with react-native link, you need to unlink the files manually.
  • Proper link (and unlink) for mp3 (to use with react-native-sound) and ttf files.

Usage

  • Install

    npm install -g react-native-asset
    # or yarn
    yarn global add react-native-asset
  • Add assets to your react-native.config.js as you would with react-native link

    ...
     assets: [
        "./src/font",
        "./src/mp3",
      ];
  • Add platform-specific assets to your react-native.config.js like so:

    ...
    assets: [
      "./src/mp3",
    ],
    iosAssets: [
      "./src/font/ios",
    ],
    androidAssets: [
      "./src/font/android",
    ],
  • Run the command and linking + unlinking is automatic!

    react-native-asset

Explanation

With react-native link you have to unlink the files manually, which is hard work.
Instead this library writes link-assets-manifest.json to the root of android and ios folders to keep track of the files which it added, for later removing it for you if missing from your assets!

Parameters

  • -p, --path - path to project, defaults to cwd.
  • -a, --assets - assets paths, for example react-native-asset -a ./src/font ./src/mp3.
  • -ios-a, --ios-assets - ios assets paths, will disable android linking
  • -android-a, --android-assets - android assets paths, will disable ios linking.
  • -n-u, --no-unlink - Not to unlink assets which not longer exists, not recommanded.

Backward compatability

  • to use react-native 0.59 and below, use version 1.1.4

react-native-asset's People

Contributors

adamaveray avatar badver avatar dependabot[bot] avatar gusparis avatar kbschmidt avatar loic-lopez avatar punksta avatar roryabraham avatar tjbenton avatar unimonkiez avatar unstableair avatar vieiralucas 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.