sachinchoolur / lightgallery.js

Full featured JavaScript image & video gallery. No dependencies
https://sachinchoolur.github.io/lightgallery.js/
Other
5.3k stars 596 forks source link

ES6/ES2015 import #57

Closed jpcaparas closed 7 years ago

jpcaparas commented 7 years ago

Would appreciate it if you can include in the README examples of how the library and its modules can be imported using the ES6 import statement.

sachinchoolur commented 7 years ago

Hi @jpcaparas ,

The following code should work fine.

import "lightgallery.js";
import "lg-zoom.js";
lightGallery(document.getElementById('lightgallery')); 
TheNemus commented 4 years ago

Well, yes, but this is not ES6 best practice.

What you're suggesting is to pollute the global namespace loading the module for its side-effects. Why not implement a good ES6 module pattern in your library, with import/exports statements?

stephanfriedrich commented 3 years ago

Hi @sachinchoolur, thx for your awesome Lightbox. Can you please support current ES6-Module specification ?

greetings

sachinchoolur commented 3 years ago

Working actively on v2 - https://github.com/sachinchoolur/lightGallery/blob/v2/src/lightgallery.ts#L42