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
[READY] data-src
format
#21
[READY] data-src
format
#21
Conversation
@oncletom So is this proposal literally just automating the If that's what the intent is of this proposal then I think that's a good first start and worth cracking on with. If that's not the intent and there is more work involved then please let me know. |
Conflicts: test/unit/core.js
…ternal dollar and tests Conflicts: test/unit/core.js
- initial tests are failing because the old feature is still working (good way to know the old expectation we are going to break) - new tests are not working because basically it's not done yet
- removed Imager `regex` option - implemented simple `{width}` interpolation
@Integralist I've fixed the typo and made the |
@oncletom cool, looks good |
The intention
Imager is actually quite flexible on the
data-src
pattern as long as you master regular expressions.Also, user needs might be simpler than a RegExp pattern that in most of the case.
The proposal
Controlling the replacement from
data-src
directly by using URI Template-like string variables (in fact deeply simplified).From:
To:
{width}
is either replaced by any suitableavailableWidths
numeric value or, by default bydata-width
's value.Additional PR will provide
{width}
interpolation (to replace by a string value, Flickr or Guardian case) and pixel density adjustement (eventually through a callback to deal with more complex replacement)