Giter VIP home page Giter VIP logo

Comments (8)

hxutixnnn avatar hxutixnnn commented on June 12, 2024 2

NOTE: Not working with production build

import { FeatherModule } from 'angular-feather';
import * as icons from 'angular-feather/icons';

@NgModule({
  ...
  imports: [
    ...
    FeatherModule.pick(icons),
    ...
  ],
  ...
})

from angular-feather.

michaelbazos avatar michaelbazos commented on June 12, 2024 2

At the moment, there is no way to pick all icons at once.
The rationale behind that choice, is that developers make the effort to create their icon module and pick only icons they are using, so we avoid overloading the resulting JavaScript bundle with unused SVG strings. Currently there are more than 280 icons, and it's very unlikely that even half of them are used in a single application.
@ALL What's your thoughts on that matter?

from angular-feather.

michaelbazos avatar michaelbazos commented on June 12, 2024 2

@avmaisak
Let's say the library developer felt that his responsibility is to offer an API that avoids bad patterns, to the extent possible :)

But, I gave it some more thinking, I can also understand your point of view, so I have reworked the library to also provide a way to import all icons. Here is how to do it:

icon.module.ts

import { NgModule } from '@angular/core';
import { FeatherModule } from 'angular-feather';
import { allIcons } from 'angular-feather/icons';

@NgModule({
  imports: [
    FeatherModule.pick(allIcons)
  ],
  exports: [
    FeatherModule
  ]
})
export class IconsModule { }

This is already available on npm, starting from version 6.0.7.

This way to pick all icons will be documented in README too, but with the warning that cherry-picking icons should stay the primary way.

Let me know if that's how you envisioned it.

from angular-feather.

avmaisak avatar avmaisak commented on June 12, 2024

any suggestions?

from angular-feather.

daniel-halldorsson avatar daniel-halldorsson commented on June 12, 2024

I agree with your current approach, seems super unlikely you would need all icons in any app, and by forcing an explicit declaration of which ones are to be included you are avoiding bloating the app with all the icons.

from angular-feather.

avmaisak avatar avmaisak commented on June 12, 2024

@daniel-halldorsson
I think, this is the responsibility of the developer. And library should not limit these possibilities

from angular-feather.

avmaisak avatar avmaisak commented on June 12, 2024

may be closed status?

from angular-feather.

michaelbazos avatar michaelbazos commented on June 12, 2024

Done 🙂

from angular-feather.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.