@s-ui/svg
Converts svg files into React Components
Last updated 2 months ago by schibstedspain .
ISC · Original npm · Tarball · package.json
$ cnpm install @s-ui/svg 
SYNC missed versions from official npm registry.

sui-svg

Converts your SVG files into React Components wrapped with SuiAtomIcon.

Features:

  • CLI for building the components
  • CLI for showing up a demo locally

Installation

$ npm i -SE @s-ui/svg

Usage

Add bundling scripts to your package.json

{
  "name": "my-awesome-package",
  "version": "1.0.0",
  "scripts": {
    "prepare": "sui-svg build",
    "start": "npm run prepare && sui-svg demo"
  }
}

Expected folder structure

A src folder with all the .svg files to be converted inside.

Output

A lib folder with the generated components will be created/overridden.

⚠️ Advice: no index.js will be generated inside the lib folder, each component should be imported independently for performance reasons.

How to use the generated lib

import YourIcon from 'your-svg-repo/lib/YourIcon'

const YourAwesomeComponent = () =>
  <div>
    <YourIcon />
    <p>Awesome text/<p>
  </div>

Also, keep in mind, you need to import the needed styles for the icons at least once in your app:

@import "your-svg-repo/lib/index";

Template

Every icon svg will be wrapped using an <AtomIcon> that means you could use all the props accepted by the component.

The wrapped code is minimal, in order to avoid performance penalties. You could check it here.

Current Tags

  • 1.5.0-beta.0                                ...           beta (a year ago)
  • 2.3.0                                ...           latest (2 months ago)

16 Versions

  • 2.3.0                                ...           2 months ago
  • 2.2.0                                ...           4 months ago
  • 2.1.0                                ...           7 months ago
  • 2.0.0                                ...           7 months ago
  • 2.0.0-beta.0                                ...           7 months ago
  • 1.10.0                                ...           10 months ago
  • 1.9.0                                ...           a year ago
  • 1.8.0                                ...           a year ago
  • 1.7.0                                ...           a year ago
  • 1.6.0                                ...           a year ago
  • 1.5.0                                ...           a year ago
  • 1.5.0-beta.0                                ...           a year ago
  • 1.4.0                                ...           a year ago
  • 1.3.0                                ...           a year ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |