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

Allow CSS images optimization (for example background image) #224

Open
pioso opened this issue Jun 17, 2024 · 2 comments
Open

Allow CSS images optimization (for example background image) #224

pioso opened this issue Jun 17, 2024 · 2 comments

Comments

@pioso
Copy link

pioso commented Jun 17, 2024

Hello @Niels-IO,

Thank you for your efforts. Good job!

The package itself works very well, but I've noticed a significant missing feature: optimization of images included in CSS, such as background images (refer to this link for details).

Have you considered this use case before?

Upon a quick review of the code, my initial idea would be to begin with the getImageUrl function (accessible here) and integrate it into an exported API interface. This way, developers could pass the necessary image and current viewport width, and receive an optimized image URL in return.

What are your thoughts on this approach? Does it seem viable to you? Do you have any alternative ideas for extending the package to support images used in CSS?

Best regards

@Niels-IO
Copy link
Owner

Niels-IO commented Jul 5, 2024

Hi @pioso,

Thanks for the suggestion. The more I think about it, it may be possible using the approach you mentioned. Do you want to create an initial PR to test this idea?

@Niels-IO
Copy link
Owner

Niels-IO commented Jul 5, 2024

I just read about this functionality in the Next.js docs:
https://nextjs.org/docs/app/api-reference/components/image#background-css

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