imgix / ember-cli-imgix

Easily add imgix functionality to your Ember application
https://imgix.github.io/ember-cli-imgix
MIT License
26 stars 13 forks source link

Add htmlAttributes attribute to allow developer to pass any html attribute to rendered img #55

Closed frederickfogerty closed 2 years ago

frederickfogerty commented 6 years ago

Before you submit:

Is your feature request related to a problem? Please describe. Right now as a developer I am limited to passing the attributes that are specified by this library. This causes PRs such as #54 to be necessary to add support for HTML attributes. Instead, it would be better if we could allow the developer to pass any HTML attribute.

Describe the solution you'd like

{{imgix-image
    path='/assets/something/user.png'
    htmlAttributes=(hash
      alt="Alt text"
    )
}}
Duder-onomy commented 6 years ago

Good News! The Ember slack delivered. If we use this, https://github.com/rwjblue/ember-angle-bracket-invocation-polyfill, which is basically the future of ember templates polyfilled. We can do things like:

Supports passing attributes to be added to the root element of the component without @ prefix
<FooBar data-test-foo-bar></FooBar>

In which case, we can leave all the htmlAttributes out of the components attributeBindings and put all that back on the invoker.

The angle bracket invocation is still a polyfill, but it is only a matter of time now: as this pr https://github.com/emberjs/rfcs/pull/311 has been merged.

frederickfogerty commented 6 years ago

Interesting @Duder-onomy. Thanks for following up! As an aside, do you ever see them moving to JSX (this looks awfully a lot like JSX already)?

frederickfogerty commented 6 years ago

For the polyfill, is it something that a consumer of ember-cli-imgix has to include, or is it something we can include at a library level?

sherwinski commented 2 years ago

Closing as this issue is quite old - but we're happy to reopen if there is still a need for this at some point in the future.