Comments (15)
Hey!
I'd be interested in implementing this—or at least, getting html-loader to play nice with responsive-loader or resize-image-loader.
I have no idea where to start, though, or even if it's a good idea. Is anyone able to point me towards a good starting point?
My credentials: I did it once before with Gulp: https://github.com/Lostmyname/lmn-gulp-tasks/blob/master/tasks/responsive-images.js
from html-loader.
This not being able to set labels thing is absolutely killing my o.c.d.
from html-loader.
I've written a little library that can inspect a sizes attribute and work out the maximum and minimum size of an image required—vs what most people do which is just divide the image width by two, then three, then four, which falls apart when your designer gives you a 10,000px wide image for an 800px wide website: https://github.com/callumacrae/sizes-extent (obviously, DPR needs to be taken into account after this)
My current thought of how to implement this feature would be inspect <img>
elements, and if they have a sizes attribute but not a srcset attribute, automatically calculate the best sizes for the image and call one of the libraries I mentioned before to get the images in their smaller sizes.
I'm pretty sure this wouldn't break backwards compatibility, and would only activate the functionality when it is needed. I can't think of any cases where you would actually want the sizes attribute but not the srcset attribute.
This would only solve half the problem, when the w descriptor is used. The other half is when the x descriptor is used for stuff like icons - double resolution on retina displays, for example. Not sure how to handle that one yet.
Sound good?
(happy to hand the library over to webpack / add some webpack org people to sizes-extent if it ends up being used)
from html-loader.
@hemanth @d3viant0ne, would you mind assisting with the design of this feature with @callumacrae.
from html-loader.
We could plan for a quick slack meeting on this sometime soon.
from html-loader.
@hemanth - My schedule is pretty flexible, i.e. I'm forever in front of my computer. Pick what works for you and i'm sure I can be there.
from html-loader.
^ Similar situation here :D
[What dose it mean when people say "go get a life"? 🤔]
Let us hear it from others.
from html-loader.
Is this a public slack network I can join? 😄
from html-loader.
@callumacrae - Webpack public is @ https://gitter.im/webpack/webpack
The slack channels are limited to the core team & and teams maintaining it's plugins.
from html-loader.
Well, I'm in the gitter, let me know if there's anything I can do to help with this feature.
from html-loader.
@d3viant0ne Maybe it would be a smart move to invite @callumacrae to the slack/meeting?
from html-loader.
We can just hangout anywhere, I am always on IRC too ;)
from html-loader.
Ok. I invited Callum to Slack just in case so you can organize as you like.
from html-loader.
Also on IRC, and now on Slack as callumacrae. Thanks, @bebraw :)
from html-loader.
posthtml-loader and a plugin
from html-loader.
Related Issues (20)
- How to trigger re-compile if partial changed? HOT 4
- when to publish tag on 'fix(getOptions): deprecation change' HOT 1
- Style attribute with expansion variable is omitted when minimized HOT 2
- Favicon: Module not found HOT 5
- After upgrading from v1.3.2 to v2.1.2, <%= require("html-loader!x.html") %> is not available. HOT 1
- Parse errors with html content containing < HOT 4
- this.getOptions is not a function HOT 1
- params “source: false” is falied HOT 2
- remove documentation of use cases involving extract-loader HOT 4
- When extending default sources, tag is not optional HOT 1
- Emits seperate js file even when target is `webworker` and max chunks is 1 HOT 7
- Readd root as webpack resolve.roots does not allow conditionally resolve HOT 3
- Possibility to extend default 'minimize' options HOT 7
- require(...) is not a function - PostHTML HOT 1
- David and HTML Loader badges are broken HOT 5
- ignoring noscript HOT 9
- DIfferent behavior in development and production modes HOT 1
- Two Created Files HOT 1
- Webpack 5 output.clean deletes loaded resources on rebuild HOT 2
- HTML comments don't show up correctly in the documentation on webpack.js.org HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html-loader.