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

svg2ember

v1.0.0

Published

Transform SVGs into Ember components.

Readme

svg2ember

This package contains the core, CLI, and Vite functionalities for svg2ember.

Features

  • Core transformation logic for converting SVG files to Ember components.
  • Command-line interface for batch processing of SVGs.
  • Vite plugin for build-time integration with Vite-based Ember projects.

Installation

To use svg2ember in your project (for example, if you want to use its Vite plugin or programmatically access its core functions):

pnpm add --save-dev svg2ember
# or
npm install --save-dev svg2ember

If you want to use the CLI tool globally:

pnpm add --global svg2ember
# or
npm install --global svg2ember

Usage

Command Line Interface

Once installed globally, you can use the svg2ember command:

svg2ember input.svg output.gjs

# Create TypeScript component
svg2ember --typescript input.svg output.gts

# Process all SVGs in the 'icons/' directory and output them to 'components/icons'
svg2ember --out-dir components/icons icons/

You can also run it without global installation using pnpx:

pnpx svg2ember input.svg output.gjs

For more CLI options, run:

svg2ember --help
# or
pnpx svg2ember --help

Vite Plugin

Configure the Vite plugin to enable SVG component imports:

// vite.config.js
import svg2ember from "svg2ember/vite";

export default {
  plugins: [
    svg2ember(),
    // other Ember plugins...
  ],
};

Then use in Ember components:

import Butterfly from '../icons/butterfly.svg?component';
import butterflyUrl from '../icons/butterfly.svg'; // standard imports unaffected

<template>
  <h1>A butterfly (component):</h1>
  <Butterfly class='h-6 w-6' data-my-icon />

  <h1>A butterfly (image):</h1>
  <img src={{butterflyUrl}} alt='butterfly' />
</template>

The class and data-my-icon attributes are passed through to the root <svg> element via ...attributes.

The component also works using block syntax and allows arbitrary SVG elements as children as long as they are valid children of the <svg> element. The {{yield}} is at the bottom, so the children will be placed below any other content in the SVG. (Keep in mind the coordinate space is determined by the viewBox.)

import Butterfly from '../icons/butterfly.svg?component';

<template>
  <Butterfly class='h-6 w-6'>
    {{! fade the icon in and out using SVG animate }}
    <animate
      attributeName="opacity"
      values="0;1;0"
      dur="500ms"
      repeatCount="indefinite"
    />
  </Butterfly>
</template>

Contributing

Issues and PRs always welcome.

License

MIT