creativelive / appear

execute callbacks when dom elements appear in and out of view
http://creativelive.github.io/appear/
MIT License
178 stars 43 forks source link

NPM module #20

Open edemaine opened 6 years ago

edemaine commented 6 years ago

I tried to use appear.js in a Meteor project via an NPM import (require('appear')) but there is no main specifier in package.json, so it won't load directly. I also tried require('appear/lib/appear') (also reasonable) but this file does not behave like a module with a default export of the appear function (nor do any of the dist versions), so it seems that there's no reasonable module entrypoint for appear.js. I imagine this wouldn't be too much effort to fix; would this be of interest as a PR?

JustinBeaudry commented 6 years ago

@edemaine It would be great to have a PR for this fix! Otherwise, I'll see what I can do to get a fix in place.

edemaine commented 6 years ago

Actually, it looks like the latest code already has support for exporting as module.exports (thanks to your commit d994af02 on 2018-06-15) -- it just hasn't been published via npm publish since.

The main pointer is currently

  "main": "appear.js",

but should be

  "main": "lib/appear.js",

I think all that's needed is that tweak plus npm publish.

JustinBeaudry commented 6 years ago

@edemaine Actually going to point main at dist/appear.js