Skip to content

Instantly share code, notes, and snippets.

@emilyfreeman
Forked from rrgayhart/require.markdown
Last active February 9, 2016 20:39
Show Gist options
  • Save emilyfreeman/317c69c80f59abd853b5 to your computer and use it in GitHub Desktop.
Save emilyfreeman/317c69c80f59abd853b5 to your computer and use it in GitHub Desktop.
The Concept of Require

When you start working with WebPack for GameTime, you'll notice that you can't just define a variable in one file and find it in another as easily as you can in Rails.

Read Node.js, Require and Exports and Organize Your Code with RequireJS

Fork this gist and answer the following questions:

  • In the context of Node, what is a module?
    • A module is a little like a class in Ruby and allows you to package and reference information in other areas of your code. The only public information is what's exported, all other information is kept private.
  • The code examples from the second blog post look very different from the first. Why?
    • They're organizing their JS into various files and using define() to require a module and bind it to a name for later referencing.
@rrgayhart
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment