Comments (8)
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.
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.
@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.
any suggestions?
from angular-feather.
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.
@daniel-halldorsson
I think, this is the responsibility of the developer. And library should not limit these possibilities
from angular-feather.
may be closed status?
from angular-feather.
Done 🙂
from angular-feather.
Related Issues (20)
- TypeError: Cannot read property 'kind' of undefined on building an app with the library HOT 7
- Possible to add custom icons? HOT 2
- Live demo is not working! HOT 2
- No suitable injection token for parameter 'elem' of class 'FeatherComponent' HOT 1
- Wrong spacing HOT 2
- ModuleWithProviders type without a generic type argument HOT 2
- How to add position alignment to the icon HOT 2
- Is there any possible way to provide icon in css or typescript file HOT 1
- Update to Angular 11 HOT 1
- Is this library alive? HOT 1
- NullInjectorError: No provider for Icons HOT 4
- Update to Angular 12 and Fix all Linting Issue HOT 4
- feather package not compatible with angular versions > 13 HOT 5
- Missing Icons HOT 1
- Providing an alt HOT 1
- Unexpected value 'FeatherModule' when developing unit tests HOT 1
- Update to angular ~13.2.0
- Angular 14 support HOT 7
- Update to Angular 15 HOT 1
- Support for Standalone components HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-feather.