Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to introduce <enhanced:bg-img /> for decorative images #12889

Closed
michaelprys opened this issue Oct 26, 2024 · 3 comments
Closed

Request to introduce <enhanced:bg-img /> for decorative images #12889

michaelprys opened this issue Oct 26, 2024 · 3 comments

Comments

@michaelprys
Copy link

Describe the problem

I suggest to add <enhanced:bg /> or <enhanced:bg-img /> for semantic purposes. For instance, some images are not content related and are mainly decorative, so for them I would want to use <enhanced:bg /> instead of <enhanced:img /> from @sveltejs/enhanced-img. Currently, I have to create a <div /> and set its background-image style. However, this approach has limitations, especially in terms of format variety. Unlike with <picture> in HTML, I can only specify one format using the @supports rule in CSS.

Describe the proposed solution

Adding a <enhanced:bg /> for semantic purposes alongside <enhanced:img />.

Alternatives considered

No response

Importance

would make my life easier

Additional Information

I have previously made this request to some frameworks, but so far, no one has been able to implement a solution like this. You could be the first to introduce a feature like this. It will simplify the lives of many developers and increase code quality. Besides, it will improve accessibility for search engines.

Thank you for considering this suggestion!

@eltigerchino
Copy link
Member

Closing as duplicate of #12339

@eltigerchino eltigerchino closed this as not planned Won't fix, can't repro, duplicate, stale Oct 28, 2024
@michaelprys
Copy link
Author

@eltigerchino Not really what I was talking about, because the amount of code in the #12339 needed for a simple background image is crazy and you need to involve js every time.

@eltigerchino
Copy link
Member

eltigerchino commented Oct 29, 2024

@eltigerchino Not really what I was talking about, because the amount of code in the #12339 needed for a simple background image is crazy and you need to involve js every time.

The code you see in that issue is only a workaround but what it's trying to achieve is to optimise images imported in CSS for decorative purposes as mentioned in this issue and JonasKruckenberg/imagetools#563

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants