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

ionicons-cleaner

v1.0.0

Published

Remove unused ionicons from build output folder and from ngsw.json

Downloads

12

Readme

Ionicons Cleaner

Remove unused Ionicons from your Angular output.

When using ionicons with Angular you have 2 issues:

  • On every build you get all the icons in the output folder. This is affecting the bundle size.
  • If you want to use Angular PWA and prefetch the icons you get the list of all icons even if you only using few of them.

This repo uses npx to remove all unused icons from the output folder and from the ngsw.json file.

NOTE: This package is still under beta testing - use it carefully.

Installation

Run npm install -g ionicons-cleaner

How to use

  • Run npx ionicons-cleaner to remove all unused icons from the output folder.
  • Run npx ionicons-cleaner --clean-ngsw to remove all unused icons from the output folder and from ngsw.json.

Dynamic icons

If you set icons dynamically, for example getting them from the server, you need then to be in your build but we don't have a way to know about them during the build. If you have any of those you may get a warning while trying to use this package. Now you have 2 options:

  1. If you sure the warming is false and you don't have icons that sets dynamically in your code you can use the force-delete option: npx ionicons-cleaner --force-delete
  2. To overcome this you can use the whitelist option to list an icons that won't be deleted even if they didn't found in the code. For example: npx ionicons-cleaner --whitelist= add close moon --force-delete

Options

| Option| Description | |:---|:---| | --output-path | By default the output path (destination of the build files) is www. If you want to run the script on a different folder you can pass the path to this option. | | --svg-dir | By default the svg folder is inside the output folder and called svg. If you store your svg files in a different folder you can change the name using this option. | | --force-delete | Delete icons even if you get the dynamic warning. Use this if you provide whitelist or if you sure the dynamic warning is false and you don't have icons that sets dynamically in your code. | | --whitelist | List of icons that won't be deleted even if they not found in the code. | | --clean-ngsw | If you are using Angular service worker set this to true to delete the unused icons from ngsw.json | | --sw-svg | The name of the svg asset group in the ngsw.json file. Default is svg. | | --dry-run | Use this to see how much icons we can delete without actually deleting them. |

Tested on:

  • Angular 12
  • Ionicons 5