Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mat-icon-import

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mat-icon-import

Include only used material icons in SVG format and reduce package size

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
32
decreased by-53.62%
Maintainers
1
Weekly downloads
 
Created
Source

Import only used material (and custom) icons in Angular

Installation

npm i mat-icon-import
#or
yarn add mat-icon-import

Usage

At first download the icons you need from here in SVG 24px format (default). The icon names are of type baseline-[key]-24px.svg. You will have to use the key when importing this lib.

Import the IconImportModule in your application module and call the forRoot() function with two parameters. At first the array of icon keys, e.g. (account_circle, add or whatever you want). The secont parameter is the path where you store the icons in your assets folder.

import { IconImportModule } from 'mat-icon-import';

@NgModule({
  imports: [ IconsModule.forRoot(['account_circle'], './assets/mat-icons') ]
})
export class AppModule {}

Register the icons where you need them. E.g. in the AppComponent to make it available in the complete application.

import { IconImportService } from 'mat-icon-import';

@Component({
  ...
})
export class AppComponent {
  constructor (private iconService: IconImportService) {
    this.iconService.register();
  }
}

Use the registered icons with

<mat-icon svgIcon="account_circle"></mat-icon>

Don't forget to include the MatIconModule from @angular/material.

Get in contact

Keywords

FAQs

Package last updated on 26 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc