On Jul 19, 2013, at 12:44, Jake Verbaten wrote:

> put it on npm. Have your users install it from npm and then use it with a 
> commonJS compliant tool like browserify.
> 
> If you really want to support everyone I recommend you use `browserify 
> --standalone` and put that code in `dist/my-lib.js` on github or your 
> website. `--standalone` generates UMD and works with everything.

Thanks everyone for the informative discussion. Browserify is what I've gone 
with. I initially could not get standalone mode to work, but I'm not sure what 
I was doing wrong because it works fine now. It has a build step, which I was 
trying to avoid, but it won't be so bad once I have it triggered automatically 
when I change the source files. Jake 0.6 has this feature, and of course there 
are standalone tools for watching files and triggering commands in response.

I was having circular dependency problems for a few days. I had forgotten that 
my library has circular dependencies between some of the classes, and splitting 
the single monolithic file into separate files glued together with require() 
had exposed the apparently common problem where without warning you get an 
empty object instead of the function you were expecting to have. But I think 
I've managed to wrangle the order of the require()s to avoid this now.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to