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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vite-plugin-kern-extra-icons

v0.4.0

Published

Vite plugin to load material icons not bundled with @kern-ux/native dynamically

Readme

vite-plugin-kern-extra-icons

This Vite plugin allows using arbitrary Material icons with KERN UX.

KERN UX provides only a very limited icon set, e.g. kern-icon--delete. To use an any icon not bundled with KERN, integrate this plugin and use any icon with the same syntax (e.g., kern-icon--fullscreen). To use the icons in filled style, use kern-icon-fill-- as prefix (e.g., kern-icon-fill--layers).

Installation

Install this package using your favorite package manager, e.g.:

npm i -D vite-plugin-kern-extra-icons

Add the plugin to your Vite configuration:

// vite.config.ts

import kernExtraIcons from 'vite-plugin-kern-extra-icons'
// ...

export default defineConfig({
	plugins: [
		kernExtraIcons(),
	],
	// ...
})

Import the generated CSS whereever you include the KERN CSS, too:

// loadKern.ts

import kernCss from '@kern-ux/native/dist/kern.min.css?raw'
import kernExtraIcons from 'virtual:kern-extra-icons'

export function loadKern() {
	const kernSheet = new CSSStyleSheet()
	kernSheet.replaceSync(kernCss)
	document.adoptedStyleSheets.push(kernSheet)

	// Don't forget to include the extra icons CSS!
	document.adoptedStyleSheets.push(kernExtraIcons)
}

if (import.meta.hot) {
	import.meta.hot.on('kern-extra-icons', ({ icons }) => {
		icons.forEach((icon) => kernExtraIcons.insertRule(icon))
	})
}

Options

You can configure this Vite plugin with options.

Using CSS @layer

If your application uses @layer grouping, you can encapsulate the KERN icons as a separate CSS layer. This is necessary if you encapsulate KERN itself into a CSS layer (remember to put the icons layer first!).

Example:

// vite.config.ts

// ...
kernExtraIcons({
	cssLayer: 'kern-ux-icons',
}),

This example yields to the following CSS:

/* virtual:kern-extra-icons */

@layer kern-ux-icons {
	/* ... */
}

Ignore files

If you have dependencies in your project that are not in a folder named node_modules, you still want to ignore them. As the differences between "first-class" code and dependencies can not be determined automatically, you can configure additional ignores.

Example:

// vite.config.ts

// ...
kernExtraIcons({
	ignoreFilename: (name: string) => name.includes('my_custom_modules'),
}),

Current limitations / Known bugs

The used KERN icons are detected by a regex search.

This has two drawbacks:

  • If you write KERN icons in a comment (e.g., // You could also use kern-icon--fullscreen), these icons will be bundled too.
  • If you generate KERN icon CSS classes (e.g., 'kern-icon--' + (isInFullscreen ? 'fullscreen-exit' : 'fullscreen')), these icons are not detected.