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

rewrite asset paths inside srcset lists #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chadkirby
Copy link

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
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