jcbrand / awesomplete

Ultra lightweight, usable, beautiful autocomplete with zero dependencies.
http://leaverou.github.io/awesomplete/
MIT License
0 stars 0 forks source link

Some more instructions for using with NPM #1

Open jonathon-love opened 6 years ago

jonathon-love commented 6 years ago

hi,

i'm trying to use this with npm and browserify, but haven't been able to get it to work.

would you consider adding some instructions on how to use it in this way? is there a function which adds all the CSS for example?

with thanks

jcbrand commented 6 years ago

Hi, I've never used Browserify before, so I'm not sure what those instructions would be.

Are you aware that this repo is a fork? You can try asking the upstream project for help with browserify.

jonathon-love commented 6 years ago

ah, i knew it was a fork, but i'd (incorrectly) reached the conclusion that the original wasn't available from NPM.

i can post this issue over there, but i am wondering how someone would use this with NPM (which is for node), without using browserify or webpack.

NPM is for node, but this is only useful from a web-browser, so it would require a framework that bundles node packages into a webpage?

i'm clearly missing something.

with thanks

jcbrand commented 6 years ago

I'm using it with NPM in a browser-specific project, specifically with converse.js.

However, I'm using require.js to do the bundling and not webpack or browserify (although both of those should work as well).

Require.js relies on the AMD module format, but can also load scripts that simply set a global variable, which is what awesomplete does (it doesn't expose it's module in the AMD format).

Browserify started as a competing bundler/loader which relies on Node.js's CommonJS format, which is different from AMD. This is all before ES6 modules became available.

Looking at the awesomplete code, I see they do wrap it for the CommonJS format, so you should definitely be able to load it with browserify.