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

vue-cached-icon

v3.1.1

Published

Caching asynchronous icons loader for Vue. Supports Ionicons, Material Design Icons, Font Awesome, custom providers, SVG literals and URLs. Renders sanitised SVG with currentColor support, also renders raster image URLs directly.

Readme

vue-cached-icon

Caching icon loader with an emphasis for loading the icons directly from the CDN.

Also supports svg string literals, urls to raster images (png, jpg, gif, webp, bmp, ico, avif) or urls to svg as source.

Demo

Demo

https://www.velis.si/vue-cached-icon/

Features

  • Renders sanitised SVG
  • Also renders raster images (png, jpg, jpeg, gif, webp, bmp, ico, avif), recognised by their URL's extension and handed straight to the browser, unsanitised, since there's no markup for DOMPurify to sanitise
  • Rejects a URL that resolves to neither a raster image nor a valid SVG, instead of rendering it half-sanitised
  • Loads from CDN, any local URL, any full URL or SVG literal
    • 'ion-*': loads from ionicons repository
    • 'mdi-*': loads from material design icons repository
    • 'fa-*': loads from font-awesome repository
  • Register your own repositories using registerIconProvider(prefix: string, urlBuilder: (name: string) => string)
  • Caches loaded icons, there will be only one HTTP request per icon as long as the app is running
  • Applies currentColor to icons: if colour is not otherwise specified, icons will have same color as HTML text
  • Sizes icons to the surrounding text by default, see Sizing and styling

Installing

npm install --save vue-cached-icon

Using

<template>
  <div>
    <!-- will load by name from Ionicons CDN -->
    <cached-icon name="ion-warning"/>

    <!-- will load from your own server or any other if full URL is provided -->
    <cached-icon name="/images/my-custom-icon.svg"/>

    <!-- raster images are recognised by extension and rendered directly as an <img>, unsanitised -->
    <cached-icon name="/images/my-custom-icon.png"/>

    <!-- will display the provided SVG, but with all processing (sanitizing, applying currentColor) -->
    <cached-icon :name="<svg...mySvgLiteral</svg>"/>
  </div>
</template>
<script setup>
  import { CachedIcon } from 'vue-cached-icon';
</script>

Sizing and styling

Icon sets ship their SVGs with a viewBox but no width / height, so the size has to come from the use site. This package provides it for you: the icon renders in an inline <span class="cached-icon-wrapper"> sized at 1em, so an icon is as big as the text around it and moves with the font size.

Everything is a plain default that your own CSS overrides — the package stylesheet is prepended to <head>, so your rules win without !important:

/* a fixed size */
.cached-icon-wrapper { width: 24px; height: 24px; }

/* or size a group of icons through the font */
.toolbar .cached-icon-wrapper { font-size: 1.5rem; }

SVGs that declare their own width / height keep them. Raster images are sized the same way through the wrapper, with object-fit: contain so their aspect ratio is preserved rather than stretched to fill it.

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

Please make sure your changes are well-tested and follow the existing code style.

Credits