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

On Shopify #236

Open
p0rcupine opened this issue May 27, 2016 · 1 comment
Open

On Shopify #236

p0rcupine opened this issue May 27, 2016 · 1 comment
Labels

Comments

@p0rcupine
Copy link

Hi and congrats for this great script. Here comes my question.

A normal img tag:
<img src="product.png" data-at2x="product@2x.png">

However I have no idea how to use this data-at2x="product@2x.png on Shopify.
Link to the relevant resource on Shopify.

I understand this is something it has to do with Shopify, not with you, but any recommendation would help.

Thanks!

@jgnewman
Copy link
Collaborator

At first glance it looks like you'd need to do something like this:

{% for image in product.images %}
    <img src="{{ image.src  }}" data-at2x="{{ image.src | replace: '.png', '@2x.png' }}" />
{% endfor %}

If you're running into a problem where Shopify is appending all of your URLs with hashes, that'll be a bit more complicated as you'll have to somehow figure out what the URL is to each version of the image.

Let me know if that was helpful.

Thanks!

@strues strues added the legacy label Jun 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants