GithubHelp home page GithubHelp logo

freddy03h / react-from-svg Goto Github PK

View Code? Open in Web Editor NEW

This project forked from moox/react-from-svg

0.0 1.0 0.0 760 KB

Turns SVG files into React Native (Web) (+optional ReasonML) components, without shitload of dependencies

License: MIT License

JavaScript 9.61% Reason 90.39%

react-from-svg's Introduction

React from SVG

Build Status Version

Repo on GitHub Repo on GitLab

Transform SVG files into React components, Native and/or Web, JavaScript and ReasonML. Without shitload of dependencies.

Install

npm install react-from-svg

# or

yarn add react-from-svg

Usage

react-from-svg --help

Usage
    $ react-from-svg <sourcePath> <outputPath> [--with-native|--with-web]

  Options
    --with-native, -native                Output code for react-native-svg
    --with-web, -web                      Output code for DOM. If --with-native is also used, will be output as .web.js files
    --with-native-for-reason, -bsnative   Output code for @reason-react-native/svg
    --with-web-for-reason, -bsnweb        Output code for reason-react
    --remove-fill, -rf                    Remove all 'fill' properties from SVGs, convenient for icons
    --remove-stroke, -rs                  Remove all 'stroke' properties from SVGs, convenient for icons
    --commonjs, -cjs                      Export as commonjs instead of es6 import/export

  Example
    $ react-from-svg assets/svgs src/Svgs --with-native --remove-fill

Generated components will have the following props that you can inject to the SVG components:

  • width
  • height
  • fill (if you use --remove-fill)
  • stroke (if you use --remove-stroke)

โš ๏ธ To see what you can expect from the transformations, check our snapshots ๐Ÿ‘€

Requirements

--with-web

Need you to install have:

--with-web-for-reason

Need you to install have:

--with-native

Need you to install have:

--with-native-for-reason

In addition to --with-native requirements, you need to install & add as bs-dependencies in your bsconfig.json:

react-from-svg's People

Contributors

broerjuang avatar dependabot[bot] avatar freddy03h avatar moox avatar

Watchers

 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.