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

@triangular/material-icons

v6.0.0

Published

Use the cool icons from Material in your app, fully tree-shaked and only loaded when necessary. Injected into the dom, and therefore IE compatible.

Downloads

4

Readme

Angular Lazy Loaded SVG Icons Library with Material Icons

Use the cool icons from Material in your app, fully tree-shaked and only loaded when necessary. Injected into the dom, and therefore IE compatible.

Deprecated!

Unfortunately material icons are not provided in a nice format that we can parse into a library anymore. Therefore I'm deprecating this library. Just use the official: https://material.angular.io/components/icon/overview

Live Demo

The live demo can be found at https://material-icons.akehir.com.

Getting Started

If you just want to use the library, follow the following 4 simple steps. For contributing, or building the library locally, see the section on building the library.

Supported Angular Versions | Angular Version | Library Version | | --------------- | ------------------------ | | 9.x | 1.0.0 | | 10.x | 2.0.0 | | 11.x | 3.0.0 | | 12.x | 4.0.0 | | 13.x | 5.0.3 |

Step 1: Install

Install the npm package.

npm i @triangular/material-icons

Step 2: Add to NgModule Imports

Then, add the MaterialIconsModule to the imports of your module(s).

import { NgModule } from '@angular/core';
import { MaterialIconsModule } from '@triangular/material-icons';

@NgModule({
    declarations: [
    ],
    imports: [
      MaterialIconsModule,
    ],
    providers: [],
    bootstrap: [],
})
export class AppModule { }

Step 3: Register the Icons in the Registry

The tree-shaking magic happens when you import icons from @triangular/material-icons/icons and register them in the MaterialIconsRegistry. By explicitly importing the icons where they are required, the tree shaking can ensure they are loaded when they are needed. If an icon is not required, it will not be bundled in your application. If an icon is required in a feature module, it will be bundled with the feature module. And if the icon is bundled in multiple feature modules, it will be bundled with the common bundle - in order to not download the same icon multiple times.

import { Component } from '@angular/core';
import { MaterialIconsRegistry } from '@triangular/material-icons';
import {
  materialIconAnkh,
  // add more icons here
} from '@triangular/material-icons/icons';

@Component({
  selector: 'app-some-component-with-icons',
  template: '<material-icon name="ankh"></material-icon>',
  styles: 'svg { color: #ccc; fill: currentColor; width: 5rem; height: 5rem; }',
})
export class SomeComponentWithIcons {

  constructor(private registry: MaterialIconsRegistry) {
    registry.registerIcons([
      materialIconAnkh,
      // add more icons here
    ]);
  }
}

Step 4: Enjoy using the Icons with a Peace of Mind

Once an icon has been registered, it can simply be used in your template. If you get the error can't bind to 'name' since it isn't a known property of 'material-icon', you need to include the MaterialIconsModule in your module.

<material-icon name="ankh"></material-icon>

Building

As a pre-requisite to build the library, you need to install all the dependencies via npm install or yarn. Furthermore, you will need to sync the projects submodules git submodule sync --recursive and git submodule update --init --recursive.

Building the Library

Before the sample app can be run, you need to build the library itself.

npm run build:lib

Building the Sample App

After building the library, it is either possible to build the sample app, via

npm run build:app

,or to run the sample app with a local dev server:

npm run start:app

Checking the bundle of the Sample App

You can verify how the application is bundled with the following command:

npm run analyze

Running the tests

Unit Tests

There are not many tests, but those that are can be run with:

npm run test -- --no-watch --progress=false --code-coverage --browsers ChromeHeadless

And coding style tests

The project follows the angular style guide and lints with the following command:

npm run lint

Built With

  • Angular - The web framework used
  • NPM - Dependency Management
  • Gitlab - Source Control & CI Runner

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning.

Version History

  • 1.0.0: Initial Release
  • 1.0.2: Documentation
  • 1.0.3: Documentation
  • 2.0.0: Add support for Angular 10
  • 3.0.0: Add support for Angular 11
  • 4.0.0: Add support for Angular 12
  • 5.0.0: Add support for Angular 13
  • 5.0.1: Upgrade rxjs to 7.4
  • 5.0.2: Upgrade svg-to-ts to 7.1
  • 5.0.3: Fix export of icons

Authors

  • Raphael Ochsenbein - Initial work - Akehir

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments