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

wicons

v0.0.3

Published

A command-line tool for generating custom CSS files with selected icons from the Wicons.

Downloads

133

Readme

Wicons

Wicons is a lightweight and customizable CSS tool that allows you to easily embed and style SVG icons using CSS variables. It provides an efficient way to select, customize, and integrate scalable icons into your web projects. With an intuitive interface, Wicons generates an optimized CSS file containing only the icons you select, embedded as Data URIs to enhance performance.

Features

  • Customizable Icons: Select from a variety of icons and generate a customized CSS file.
  • SVG Icons: Icons are embedded as SVGs, ensuring scalability and crisp rendering.
  • Dark Mode Compatibility: Built-in support for light and dark themes.
  • Optimized Performance: Uses CSS variables and lightweight SVG definitions for better performance.
  • Simple Integration: Easily include the generated CSS file in your project with minimal configuration.
  • Downloadable CSS: Generate and download your custom CSS file with selected icons.

Getting Started

Installation

You have two options for using the wicons tool:

  1. Use the Web Interface

    Visit wipodev.com/wicons to access the icon selection interface. Choose the icons you need and generate a downloadable CSS file with only the selected icons. This is the recommended way to use the Wicons tool, as it keeps your CSS lean and optimized.

  2. Install via npm

    If you prefer to generate the CSS using your own icons, you can install the full package using npm:

    # Install package globally
    npm install -g wicons
    
    # or you can install it in your project
    npm install wicons

    After installing, you can use the wicons command to generate CSS with your preferences.

  3. Using via npm

    If you prefer to use all the available icons, you can install the full package using npm and then import the CSS file into your project:

    @import "node_modules/wicons/dist/wicons.embed.all.min.css";

Usage wicons tool

The wicons CLI tool offers multiple options to customize the number of icons and how they are referenced in the CSS. Below are the available options:

# If I install it globally use:
wicons [options]

# If you install it in your project use:
npx wicons [options]

Options

  • -p, --path : Specifies the path to the folder containing your SVG icons.

    • Default: lib/svg in the current working directory.
  • -m, --mode : Sets the execution mode.

    • Options: build (default) or dev.
  • -o, --output : Specifies the output folder for the generated CSS file.

    • Default: None (the CSS file will be generated in the current directory).
  • -f, --filename : Sets the output file name for the CSS file.

    • Default: None (a default file name will be used).
  • -e, --embed: If specified, embeds SVGs as Data URIs directly in the CSS.

    • Default: false.

Example wicons tool

Generate a CSS file with default settings:

   wicons

Generate a CSS file with a specified path to your SVG icons folder:

   wicons --path ./my-icons/svg

Run in development mode:

   wicons --mode dev

Set a custom output directory and filename:

   wicons --output ./dist --filename icons.css

Embed SVG icons as Data URIs directly in the CSS:

   wicons --embed

Combine options as needed to customize the CSS generation fully. For example:

   wicons --path ./assets/svg --output ./public/css --filename custom-icons.css --embed

This flexibility allows you to control where and how your icons are generated for optimal performance and integration in your project.

Use in your project

The Wicons tool offers two ways to use icons:

  1. Using CSS Classes

    Add the base class wi to the element and specify an additional class for the desired icon.

    For example:

    <i class="wi wi-loading"></i>
    This method sets the icon on the element. If you place text or other content inside the element, the element and icon will not be displayed
  2. Using data-icon Attribute

    Alternatively, you can specify the icon using the data-icon attribute. This will add the icon to the ::before pseudo-element:

    <i data-icon="loading"></i>

Example in your project

Here’s an example of how to use the icons:

This will display the selected icons with the default styles. You can further customize them with your own CSS if needed.

<i class="wi wi-loading"></i>

<i data-icon="loading"></i>

Contributing

If you want to modify the tool or add new features, you can do so by creating a fork of the repository. Alternatively, you can clone the repository directly if you want to make direct modifications:

git clone https://github.com/wipodev/wicons.git

Pull requests are welcome for any improvements or new icon additions!

Attribution

The icons used in this project are from Font Awesome and are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0). Appropriate credit should be given as specified in the license.

License

Code License

The code in this project is licensed under the MIT License. - see the LICENSE file for details.

Icons License

The icons provided in this project are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).

You are free to:

  • Share — copy and redistribute the material in any medium or format
  • Adapt — remix, transform, and build upon the material for any purpose, even commercially.

Under the following terms:

  • Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.