merkle-open / gondel

🚡 Gondel is a tiny library to bootstrap frontend components
https://gondel.js.org
MIT License
36 stars 10 forks source link

feat(core): fallback to classname as componentname #45

Closed adriankremer closed 5 years ago

adriankremer commented 5 years ago

To make it easier to spawn a component i want the ComponentName to be optional and to get the ClassName as default.

What changes did you make?

I made the componentName optional and invoked the className as default.

Does this pull request introduce a breaking change?

no!

jantimon commented 5 years ago

Angular 1 did it that way but unfortunately it does not work after minification as class Button becomes function a.

So they had to introduce a second syntax which allowed to pass the name in an array syntax.

adriankremer commented 5 years ago

Damn thats right. The only way would be to do something like

new Gondel({
  components: {
    componentA,
    componentB
  }
});

isnt it?

jantimon commented 5 years ago

Correct that would work but would probably be very hard to type with typescript

janbiasi commented 5 years ago

@jantimon I already talked with you about a possible solution by defining the component name as static property - metadata reflection (sadly 😢) isn't a possibility in our case, since not every project uses gondel with typescript ...

cc @adriankremer

jantimon commented 5 years ago

And I guess even if it would work the metadata would blow up the bundle size