Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minimal example for use in the browser #105

Open
jtwaleson opened this issue Sep 8, 2014 · 6 comments
Open

minimal example for use in the browser #105

jtwaleson opened this issue Sep 8, 2014 · 6 comments

Comments

@jtwaleson
Copy link

I've been trying to get a minimal setup to work in the browser for a couple of hours now, to no avail. I think it would be useful to explain how the require pattern can be used. It might help javascript noobs like myself on their way.

@creationix
Copy link
Owner

js-git is packaged as common-js. You'll need to use some sort of build system to pre-process the files for use in the browser. I usually either do it server-side in wheaty https://github.com/creationix/wheaty-cjs-bundler or client side. https://github.com/creationix/tedit/blob/master/build/ui/loader.js

You could probably use browersify too, but I haven't tried in a while. http://browserify.org/

@creationix
Copy link
Owner

Here is a example of using wheaty-cjs-bundler. https://github.com/creationix/conquest/blob/svg/conquest.js

This repo is served with wheaty https://github.com/creationix/wheaty. Since the file is marked as executable in git and starts with #!js it will be run server-side in wheaty and serve the result to the browser.

@jtwaleson
Copy link
Author

Thanks, browserify seems to do the trick! I'll see if I can get a working example and send a pull request with added documentation about build instructions. Do you have any thoughts about rewriting from common-js to AMD?

@creationix
Copy link
Owner

I'm glad it helped. No, I'm not going to rewrite in AMD. I may rewrite in
ES6 modules once the tool ecosystem is more mature for them though.

On Wed, Sep 10, 2014 at 2:50 AM, Jouke Waleson notifications@github.com
wrote:

Thanks, browserify seems to do the trick! I'll see if I can get a working
example and send a pull request with added documentation about build
instructions. Do you have any thoughts about rewriting from common-js to
AMD?


Reply to this email directly or view it on GitHub
#105 (comment).

@kumavis
Copy link

kumavis commented Sep 17, 2014

@jtwaleson would like to see your work, as I plan to use this with browserify

@rksm
Copy link

rksm commented Jun 22, 2016

A browserified version of js-git (that uses promises instead of generators) can be found here: https://github.com/LivelyKernel/js-git-browser.

Thx @creationix for this great project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants