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

feather-icon-literals

v1.0.0-rc.11

Published

The Feather Icons you know and love as Template Literals tagged with a settable processor.

Downloads

15

Readme

Feather Icon Literals

Access a growing family of icons for use across varied project contexts via tagged template literals. By default these icons are delivered via what amounts to a pass through tag, allowing the various icons to be used as if they were vanilla strings.

import { Circle } from 'feather-icon-literals';

console.log(Circle());

/***
<svg
  xmlns="http://www.w3.org/2000/svg"
  viewBox="0 0 24 24"
  fill="none"
  stroke="currentColor"
  class="feather feather-circle"
  strokeWidth="2"
  strokeLinecap="round"
  strokeLinejoin="round"
>
  <circle cx="12" cy="12" r="10" />
</svg>
***/

However, if you're already working with a specific parser on your project, you can apply that parser here to be sure that the SVG content is delivered as parsed content to your final template. The means if you were working with lit-html you could apply the html tag to your icons via setCustomTemplateLiteralTag:

import { Circle, setCustomTemplateLiteralTag } from 'feather-icon-literals';
import { html } from 'lit-html';

setCustomTemplateLiteralTag(html);

console.log(Circle());

/***
TemplateResult {strings: Array[1], values: Array[0], type: "html", processor: DefaultTemplateProcessor, constructor: Object}
***/

Similar could be said about Preact via the htm tag as bound to the provided hyperscript function:

import { Circle, setCustomTemplateLiteralTag } from 'feather-icon-literals';
import htm from 'htm';
import { h } from 'preact';

const hPreact = htm.bind(h);

setCustomTemplateLiteralTag(hPreact);

console.log(Circle());

/***
VNode {nodeName: "svg", children: Array[1], attributes: Object, key: undefined, constructor: Object}
***/

This goes on and on for whatever tagged template based template parser you might apply now (or in the future) in building your application. That means that you can now use the same icons across multiple projects, between multiple teams, and over whatever refactoring requirements might come you way in the future.

Feather Icons

Feather Icons provide a collection of simply beautiful open source icons for use in your website or application. This ever growing collection of high quality SVG based icons is brought to the community by @colebemis and provides an invaluable tool for visually communicating functionality and intent across your work.

Tagged Template Literals

The template literal brings quality string templating to the JS ecosystem, demarcated by back tickets "`" and allowing the use of embedded expressions. These literals can be parsed with a function via "tagging", which will pass the template as an array of static string values followed by arguments related to the various expressions embedded in the literal. This allows tools like HTM, hyperHTML, and lit-html to rely on platform standard technologies to parse templating for use with various renderers.

Prior Art

There are many projects that work to make using Feather Icons more easily in your projects/frameworks (including the default implementation). In particular, feather-icon-literals borrows much from the work of Carmelo Pullara in react-feather which coverts the Feather Icons in the functional React components. You will find much in common between the build process applied between the two projects, and for the learning I have taken from that process I would like to thank Carmelo profusely.