-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
[WIP] Automatically call responsive-loader, generate srcset from sizes #106
Conversation
Oooops, left some ES6 in sizes-extent by mistake. will fix that 😄 |
Codecov Report
@@ Coverage Diff @@
## master #106 +/- ##
==========================================
+ Coverage 96.93% 97.56% +0.62%
==========================================
Files 2 2
Lines 98 123 +25
Branches 19 23 +4
==========================================
+ Hits 95 120 +25
Misses 3 3
Continue to review full report at Codecov.
|
Any updates on this? |
Been super busy with a couple other things, but am definitely planning on completing this at some point. |
Working on this today 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature would be awesome 😁 👍
index.js
Outdated
var hrefWithoutParams = href.slice(0, href.indexOf('?')); | ||
|
||
var requireSizes = JSON.stringify( | ||
'responsive' + params + '!' + loaderUtils.urlToRequest(hrefWithoutParams, root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be responsive-loader
, because webpack 2 doesn't append -loader
automatically
index.js
Outdated
throw new Error('sizes attribute not understood: ' + data[match].sizes); | ||
} | ||
|
||
var responsive = 'responsive?min=' + extent[0] + '&max=' + (extent[1] * MAX_DPR) + '!'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
@jhnns: Will make that change. Currently waiting on dazuaz/responsive-loader#31 |
dazuaz/responsive-loader#31 has been merged which means I can now finish this PR 🎉 will do it at some point this week |
I've rebased the PR to get rid of conflicts. I have no idea why the tests are failing though - something to do with js-beautify. |
How is the current state for it? It would be perfect it the html-loader could "replace" |
This PR was taking a lot of my time and it turned out I was actually working on the wrong project: html-loader isn't used for Vue templates. I think it would probably be best if someone else took this PR over, as I can't justify dedicating spending any more time at work on this when we're not actually going to benefit from it! |
Regarding: #73
<img src="./img.jpg?sizes[]=100&sizes[]=200&sizes[]=300">
?Syntax being called doesn't actually exist yet: dazuaz/responsive-loader#26it's in a PR: dazuaz/responsive-loader#31This is in theory a breaking change, but only if people are using
sizes
withoutsrcset
already (this makes no sense). Also, we should talk about whether this should be a plugin / another loader :)