Skip to content

Add support for CSS's image-set() syntax #9931

Closed Answered by brandonkelly
proimage asked this question in Ideas
Discussion options

You must be logged in to vote

Proper image-set support is still basically nonexistent without using a -webkit- prefix, so the only way we could do this right now that would be of any help would be to add a getBgCss() method, which returns multiple background-image style definitions, per the example in that CSS Tricks article. That feels a little too gross to me to be part of the core API, though. Maybe better suited for a plugin, implemented via a behavior.

That said, I’ve just added a new getUrlsBySize() method (d6930cc), which handles all the grunt work that used to live within getSrcset(). It returns an array of image transform URLs, indexed by size. You can use that along with your own bgCss() macro:

{% macro bgCss(

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@brandonkelly
Comment options

@proimage
Comment options

@brandonkelly
Comment options

Answer selected by brandonkelly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
site development 👩‍💻 features related to website/API development
2 participants