liwenyip / hugo-easy-gallery

Automagical css image gallery in Hugo using shortcodes, with optional lightbox/carousel gadget using PhotoSwipe and jQuery.
MIT License
573 stars 111 forks source link

POC of removing jquery #27

Open Artiavis opened 6 years ago

Artiavis commented 6 years ago

Hey, thanks for creating this plugin! It's proven really helpful (still massaging my installation but getting very close)!

I noticed you're using jQuery, and figured I'd send you a POC where it can be removed (although I may have missed 1-2 things, not promising this is perfect). Photoswipe already assumes IE8+; it's only a short jump to not having it. Could be worth considering for those who don't want/need jQuery and don't currently have it.

liwenyip commented 5 years ago

Hi @Artiavis,

Thanks for your contribution.

I do understand your point about jQuery not really being necessary, but I haven't coded anything for 2 years, and I don't understand my own code anymore, so I have to take the approach of "if it isn't broken, don't fix it".

You make a good point though :-)

Instead of changing static/js/load-photoswipe.js, could you create a new file called static/js/load-photoswipe-nojquery.js and put comments in the other relevant files to explain how to use the nojquery version if you want to?

Regards, Li-Wen