You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refractalize edited this page Jul 8, 2012
·
1 revision
Omit the .pogo extension
To require a script written in pogo, just require the filename without the .pogo extension, for example if you had a pogo file called stuff.pogo, then you'd require it like this:
stuff = require './stuff'
require will look for and find the file stuff.pogo in the same directory.
Works when compiled into JavaScript
This also works if you happen to compile both stuff.pogo and the file you required it from. Both files turn into .js files, and Node just finds them, just as it does with normal JavaScript.
.js is preferred over .pogo
The only thing to keep in mind is that if you have both stuff.js and stuff.pogo in the directory, Node will use the stuff.js file. This can be confusing when you've made changes to the .pogo file and they don't seem to have had any effect. In this case, either recompile or remove the .js.