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

Not an issue, a question re: require() #7

Closed
walterdavis opened this issue Jan 24, 2013 · 1 comment
Closed

Not an issue, a question re: require() #7

walterdavis opened this issue Jan 24, 2013 · 1 comment

Comments

@walterdavis
Copy link

First off, this is truly awesome code, very clearly written, and I hope to crib some of its style (if not substance) in other work I am doing.

Second, in the "browser" version, I see reference right up at the top to

require("color-convert")

and the like. I am of the opinion that require is a Node thing, not part of the JavaScript language. Is my impression wrong? If not, how does this work in a non-node setting? I don't see require() defined anywhere in the code.

Thanks again for writing this!

Walter

@harthur
Copy link
Collaborator

harthur commented Jan 27, 2013

You're right, require() is a built-in thing in node.js and not in the browser, but you can define your own require() function in the browser if you want. That's what the browserify module does. It takes all the modules in the directory, squashes them into one file and appends a require function definition. You can then use this file in the browser just as you would from node.

@harthur harthur closed this as completed Mar 7, 2014
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

2 participants