Giter Club home page Giter Club logo

Comments (15)

callumacrae avatar callumacrae commented on September 21, 2024 1

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.

joshwiens avatar joshwiens commented on September 21, 2024

This not being able to set labels thing is absolutely killing my o.c.d.

from html-loader.

callumacrae avatar callumacrae commented on September 21, 2024

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.

TheLarkInn avatar TheLarkInn commented on September 21, 2024

@hemanth @d3viant0ne, would you mind assisting with the design of this feature with @callumacrae.

from html-loader.

hemanth avatar hemanth commented on September 21, 2024

We could plan for a quick slack meeting on this sometime soon.

from html-loader.

joshwiens avatar joshwiens commented on September 21, 2024

@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.

hemanth avatar hemanth commented on September 21, 2024

^ Similar situation here :D

[What dose it mean when people say "go get a life"? 🤔]

Let us hear it from others.

from html-loader.

callumacrae avatar callumacrae commented on September 21, 2024

Is this a public slack network I can join? 😄

from html-loader.

joshwiens avatar joshwiens commented on September 21, 2024

@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.

callumacrae avatar callumacrae commented on September 21, 2024

Well, I'm in the gitter, let me know if there's anything I can do to help with this feature.

from html-loader.

bebraw avatar bebraw commented on September 21, 2024

@d3viant0ne Maybe it would be a smart move to invite @callumacrae to the slack/meeting?

from html-loader.

hemanth avatar hemanth commented on September 21, 2024

We can just hangout anywhere, I am always on IRC too ;)

from html-loader.

bebraw avatar bebraw commented on September 21, 2024

Ok. I invited Callum to Slack just in case so you can organize as you like.

from html-loader.

callumacrae avatar callumacrae commented on September 21, 2024

Also on IRC, and now on Slack as callumacrae. Thanks, @bebraw :)

from html-loader.

michael-ciniawsky avatar michael-ciniawsky commented on September 21, 2024

posthtml-loader and a plugin

from html-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.