• Stars
    star
    113
  • Rank 310,115 (Top 7 %)
  • Language
    JavaScript
  • Created about 8 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

💅 Bundle your SVG into a fully customized React components

GitHub release

🤔   What is it?

If you work with React, you know that the library enables you to manage and use your icons in a lot a ways. This is good because you have flexibility to manage them as you want. So, in many cases this workflow can become a manual and massive process that you need to do so many times.

Reicons is a simple CLI tool that helps you to manage and use your icons quickly and easily.

👌   Advantages

  • Require your icons as a simple React component
  • Customize your icons with just css or inline styles
  • Resize them in a prop way
  • No .svg, .png or .jpg inside your bundle

That's great no? See more information above about how to use!

🔌   Install

The first thing that you need to do to use Reicons is install it globally or as a dependency at your project:

$ yarn [global] add reicons

After that you can see it working:

$ reicons --help

reicons -p [<package-dir:package-prefix>] -s <dir> -b <dir>

Options:
  --version       Show version number                     [boolean]
  --packages, -p  Your svg icons packages                 [array]
  --src, -s       Directory with the icons folder         [string]
  --build, -b     Build directory                         [string]
  --help          Show help                               [boolean]

💻   Example

Let's use the default example folder as example. There's we have an images folder that have two folders font-awesome and icons with a lot of svg files inside. So, we want to build our components at folder components/Icons. To do that, we can run:

$ cd example/default
$ reicons -p font-awesome:fa icons:ic -s images -b components/Icons

After this command, Reicons will generate our components in a folder structure like that:

.
└── components
    └── Icons
        └── index.js

With that you can just import your icons as a simple React component:

import { FaBook } from './components/Icons';

const App = () => (
  <div>
    <FaBook />
  </div>
);

or import the entiry bundled icons and define what you want passing a prop name

import Icon from './components/Icons';

const App = () => (
  <div>
    <Icon name="FaBook" />
  </div>
);

  Usage

You need to know just few things to use the tool. As you've seen above, Reicons need to read a list of svg icons and know where you want to bundle your components.

So, to bundle your icons you need to pass three arguments: --package, --src and --build.

--package

One or more packages that you will use as icons. This argument has a default style to write, because we need it to find and create your svg files.

The default style to write your package is: <package-directory>:<package-prefix>

The package-directory is the folder name of your svg icons and the package-prefix is the name that we will use to prefix your components.

--src

The source directory when your packages folder is.

--build

The build directory when you want to create your components.

More Repositories

1

react-adopt

😎 Compose render props components like a pro
TypeScript
1,681
star
2

reworm

🍫 the simplest way to manage state
TypeScript
1,464
star
3

micro-router

🚉 A tiny and functional router for Zeit's Micro
JavaScript
621
star
4

react-video

🎞 React component to load video from Vimeo or Youtube across any device.
JavaScript
273
star
5

react-simpletabs

Just a simple tabs component built with React
JavaScript
188
star
6

algorithms-with-es6

Just a bunch of algorithms using Javascript with ES6
JavaScript
161
star
7

gatsby-starter-docz

📝 Gatsby starter with Docz and a blog for your documentation
JavaScript
90
star
8

frontend-styleguide

Keep your code clean, legible and beautiful!
CSS
69
star
9

spacefold

Use Pub/Sub pattern inside your React applications easily
TypeScript
61
star
10

oneoften

Tips, tricks, tutoriais and many things about "How building a Large Scale application with Javascript"
44
star
11

yarn-workspaces-example

Sample monorepo project using new Yarn feature called Workspaces
JavaScript
41
star
12

which-licenses-i-have

📝 Learn about the licenses around your package
JavaScript
29
star
13

docz-plugin-react-native

Plugin that allow you to use React Native with docz
JavaScript
21
star
14

storz

Global state machines in an easy way
TypeScript
21
star
15

shazam

⚡️ An opinionated and usefull react app management
JavaScript
17
star
16

hacker-news-es6

Hacker News feed built with ECMAScript 6 and jQuery
JavaScript
17
star
17

vitejs-boilerplate

ViteJS boilerplate with TailwindCSS, React Router v6, Typescript and more.
TypeScript
15
star
18

libundler

JavaScript
14
star
19

nextjs-boilerplate

NextJS boilerplate with some cool stack
TypeScript
12
star
20

promiseJS.br

Tradução do site http://www.promisejs.org/
CSS
11
star
21

certifyJS

NodeJS module that generate a course certificate in PDF
JavaScript
9
star
22

eleicoes2022

Estudos analítico encima dos dados do TSE sobre o resultado das Eleições 2022 no Brasil
7
star
23

notion-todo

Todo app made using the Notion API
JavaScript
6
star
24

xresource

TypeScript
6
star
25

reason-todo-example

Just a simple todo app built with ReasonML
OCaml
5
star
26

to-titlelize

NodeJS module to format string in titlelize
JavaScript
4
star
27

pedronauck.com

My website 🔥
JavaScript
3
star
28

jarvis

Central de conteúdo sobre desenvolvimento da GoNorth
2
star
29

builder-skeleton

Just a test for Stackblitz api
HTML
2
star
30

create-dataset

Experiment recreating React Context using plain Javascript
JavaScript
2
star
31

nvim

My current Neovim configuration
Lua
2
star
32

typescript-with-docz-example

Just a simple test
TypeScript
2
star
33

react-grocery-list

This is a sample Grocery List application to test ReactJS + Gulp + Browserify
JavaScript
2
star
34

xstate-fp

Just another approach to write state machines for XState
1
star
35

zmk-config

My zmk configuration
1
star
36

fusebox-preact-example

Sample application using FuseBox and Preact
JavaScript
1
star
37

docz-plugin-svgr

Use svgr as loader for svg images
TypeScript
1
star
38

teste-repo

Teste de repositório
1
star
39

datocms-blog-demo-5245

JavaScript
1
star
40

astronvim_config

Astro vim config
Lua
1
star
41

mediator

Mediator pattern applied on React
TypeScript
1
star
42

csb-xut4hw

HTML
1
star