Skip to content

rewrite asset paths inside srcset lists#56

Open
chadkirby wants to merge 1 commit intoember-cli:masterfrom
chadkirby:rewrite-srcset-paths
Open

rewrite asset paths inside srcset lists#56
chadkirby wants to merge 1 commit intoember-cli:masterfrom
chadkirby:rewrite-srcset-paths

Conversation

@chadkirby
Copy link
Copy Markdown

Fixes #51

According to MDN, the srcset attribute contains:

A list of one or more strings separated by commas indicating a set of possible image sources for the user agent to use. Each string is composed of:

  1. a URL to an image,
  2. optionally, whitespace followed by one of:
  • a width descriptor, or a positive integer directly followed by 'w'.
  • a pixel density descriptor, which is a positive floating point number directly followed by 'x'.

The rewriteAssetPath logic seems to behave properly if we simply allow assetPaths to begin/end with commas (in addition to quotes, open paren, and equals). The match will include the width/pixel-density descriptor at the end, but that does not appear to cause problems (in the admittedly few cases that I've tested).

@rickharrison
Copy link
Copy Markdown
Collaborator

This looks good to me. Anyone from the Ember team want to confirm everything looks good inside a real world app?

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

Successfully merging this pull request may close these issues.

2 participants