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

Retina 2x <lasso-img> #154

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

Conversation

oxala
Copy link

@oxala oxala commented Jul 17, 2016

#151

  • Added support to add "2x" retina images using srcset="./path.png" in ;
  • Updated tests;

@patrick-steele-idem

After a couple of attempts to do it and process srcset={"2x": "./path.png"} - i failed and fallen-back to a simpler solution.

The problem i couldn't resolve was that marko/compiler/Builder didn't like me passing array instead of a single src here (https://github.com/lasso-js/lasso/compare/master...oxala:Lasso-img-Retina?expand=1#diff-bceb7acc917818bc45d3fb926f0dd232R55) and was crashing (with message like arg should be string, Node or null). Even though you said i need to allow arrays inside taglib/helper-getImageInfo.js, i think it's not the case, since it doesn't even get there, the Builder error comes before that.

Solution below adds processed srcset="./path.png to the result image in format srcset="/static/.../path.png 2x", so >2x are at least presented with 2x image. If there is not srcset on the lasso-img, then of course no srcset presented in the output.

P.S And of course if this implementation can be improved (or if it's complete rubbish) - i would love to hear it.

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.

1 participant