npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

reicons

v0.4.7

Published

CLI tool to generate React icons component using svg files

Downloads

15

Readme

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

  • [x] Require your icons as a simple React component
  • [x] Customize your icons with just css or inline styles
  • [x] Resize them in a prop way
  • [x] 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.