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 🙏

© 2026 – Pkg Stats / Ryan Hefner

eleventy-plugin-phosphoricons

v2.0.0

Published

A flexible icon family for interfaces, diagrams, presentations — whatever, really.

Readme

eleventy-plugin-phosphoricons

npm npm license

An Eleventy shortcode, allows Phosphor icons to be embedded as inline svg or render as an image in your Eleventy project.

Demo: https://eleventy-plugin-phosphoricons.netlify.app/

Requirements

  • Eleventy 2.0 or higher (CJS) / Eleventy 3.0 or higher (ESM)

Installation

Install the plugin from npm:

npm install eleventy-plugin-phosphoricons --save-dev

Configuration

  • class - The class attribute to be added to the svg element. Default: phicon
  • style - The style attribute to be added to the svg element. Default: undefined
  • size - The width and height attribute to be added to the svg element. Default: 256
  • fill - The fill attribute to be added to the svg element. Default: currentColor
  • width - The width attribute to be added to the img element. Default: taken from the size attribute
  • height - The height attribute to be added to the img element. Default: taken from the size attribute
  • render - The render method allows you to render icon as inline svg or image. Default: svg, other options: image or img
  • transformClass - A CSS class that you want to map using a callback function transformFill. Default: false
  • transformFill - A callback function to transform the fill attribute, based on transformClass attribute. Default: undefined

If render is set to image or img, the following attributes can be used:

  • alt - The alt attribute to be added to the img element. Default: altPrefix + iconName
  • altPrefix - The alt attribute prefix to be added to the img element. Default: icon
  • loading - The loading attribute to be added to the img element. Default: lazy
  • decoding - The decoding attribute to be added to the img element. Default: async
  • eleventyIgnore - The eleventyIgnore attribute to be added to the img element to prevent @11ty/eleventy-img plugin from processing the image. Default: true

Usage

Add it to your Eleventy Config file:

ESM (Eleventy 3.x):

import eleventyPluginPhosphoricons from 'eleventy-plugin-phosphoricons';

export default function (eleventyConfig) {
    eleventyConfig.addPlugin(eleventyPluginPhosphoricons);
};

CommonJS (Eleventy 2.x):

const eleventyPluginPhosphoricons = require('eleventy-plugin-phosphoricons');

module.exports = function (eleventyConfig) {
    eleventyConfig.addPlugin(eleventyPluginPhosphoricons);
};

Advanced usage:

import eleventyPluginPhosphoricons from 'eleventy-plugin-phosphoricons';

export default function (eleventyConfig) {
    eleventyConfig.addPlugin(eleventyPluginPhosphoricons, {
        class: "phicon",
        style: "vertical-align: middle;",
        size: 32,
        fill: "currentColor"
    });
};

Using transformFill callback function

May be useful if you using a CSS framework like Tailwind CSS, Bootstrap, etc. and you want to map the fill attribute to the text color classes.

TailwindCSS usage example:

import eleventyPluginPhosphoricons from 'eleventy-plugin-phosphoricons';
import resolveConfig from 'tailwindcss/resolveConfig.js';
import tailwindConfig from './tailwind.config.js';

const fullConfig = resolveConfig(tailwindConfig);

export default function (eleventyConfig) {
    eleventyConfig.addPlugin(eleventyPluginPhosphoricons, {
        class: "phicon",
        style: "vertical-align: middle;",
        size: 32,
        fill: "currentColor",
        transformFill: (color) => {
            const [baseColor, shade] = color.replace('text-', '').split('-');
            return shade ? fullConfig.theme.colors[baseColor][shade] : fullConfig.theme.colors[baseColor]['DEFAULT'];
        }
    });
};

What does it do?

The plugin turns 11ty shortcodes like this:

{% phosphor "phosphor-logo" %}

or

{% phicon "phosphor-logo" %}

into HTML code like this:

<svg xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 256 256"
     fill="currentColor"
     class="phicon"
     style="vertical-align: middle;"
     width="32" height="32">
    <path d="M144,24H64a8,8,0,0,0-8,8V160a80.09..."></path>
</svg>

Template Usage

Nunjucks

With object attributes:

{% phicon "phosphor-logo", "duotone", {
    style: "color:red",
    size: 64,
    class: "phicon bg-blue"
} %}

Render as image:

{% phicon "phosphor-logo", "fill", { render: 'image' } %}

Liquid

With extra CSS classes (string):

{% phicon "star" "fill" "text-yellow-500 hover:scale-110" %}

Basic usage:

{% phicon "phosphor-logo" %}
{% phicon "phosphor-logo" "duotone" %}

Icon Types

Six icon variants are available: regular (default), thin, light, bold, fill, duotone

{% phicon "heart" %}
{% phicon "heart" "thin" %}
{% phicon "heart" "light" %}
{% phicon "heart" "bold" %}
{% phicon "heart" "fill" %}
{% phicon "heart" "duotone" %}

Contributing

If you notice an issue, feel free to open an issue.

  1. Fork this repo
  2. Clone git clone [email protected]:reatlat/eleventy-plugin-phosphoricons.git
  3. Install dependencies npm install
  4. Build npm run build
  5. Serve locally npm run dev

License

The code is available under the MIT license.