grunt-cache-bust icon indicating copy to clipboard operation
grunt-cache-bust copied to clipboard

Added support for lazy loading

Open bhaskarmelkani opened this issue 9 years ago • 9 comments

Adding support for lazy loading, this is already done in this fork of you branch. I am using the same fork in lot may projects in production environments with and without lazy load. Thought, to create a PR for it. :)

bhaskarmelkani avatar Jan 26 '16 09:01 bhaskarmelkani

Thanks for the PR. I'll have a look at merging this later. FYI, the next version of the plugin (currently the beta version on npm) will remove the need for adding filters to allow this to happen. You can take a look at what's changed in #147 or by changing to that branch and reading the README

benhoIIand avatar Jan 26 '16 10:01 benhoIIand

I'm slightly confused — what exactly does it do?

ArmorDarks avatar Apr 04 '17 19:04 ArmorDarks

@ArmorDarks A lot of times we use lazyloading of images, some common approaches are like using lazy class or data-original. I added support so that we can cache bust these implementations as well.

bhaskarmelkani avatar Apr 05 '17 14:04 bhaskarmelkani

@bhaskarmelkani Ah, I see. So how exactly does it work? I can't check the code, probably because of rebasing whole PR has been messed up and it's hard to read changes now...

So it just scans data attributes too?

ArmorDarks avatar Apr 05 '17 14:04 ArmorDarks

@ArmorDarks Yeah, but its been very long since I updated it. And it working perfectly fine some of my production systems. May be I will rebase the PR.

bhaskarmelkani avatar Apr 05 '17 14:04 bhaskarmelkani

May be I will rebase the PR.

I think it would be wise to do so, otherwise it's very hard to review it.

Yeah, but its been very long since I updated it. And it working perfectly fine some of my production systems.

I just wanted to know how exactly it finds which data attributes have to be processed too.

ArmorDarks avatar Apr 05 '17 14:04 ArmorDarks

@ArmorDarks It looks like the whole implementation is changed now, the support for filters is removed.

bhaskarmelkani avatar Apr 05 '17 14:04 bhaskarmelkani

Yeap, as @hollandben mentioned above.

Though, I think general idea of this PR is great, since it's indeed would be cool if lazyloaded images would be cachebusted too. However, maybe we should add config to state data attributes which should be cachebusted explicitly? Otherwise I have feeling that we might end up in awkward situation when something like data-example-image-name='image.jpg' will be cachebusted by accident too just because of similar name, while you wanted to put inside only example of name.

ArmorDarks avatar Apr 05 '17 15:04 ArmorDarks

Yeah makes sense, maybe I will update the new implementation

bhaskarmelkani avatar Apr 05 '17 15:04 bhaskarmelkani