require(s) will be evaluated from the starting scripts.
After that you can refer all paths from your starting point.
Den onsdagen den 4:e januari 2012 kl. 10:49:36 UTC+1 skrev Peter Sunde:
Consider having some folders that you want to be accessible within your
application without resulting to absolute/relative paths.
Say you have your standard lib setup:
lib/core/strap.js
lib/route/route.js
Say you have your standard views setup:
views/admin/index.js
views/a/deep/link/index.js
You do not want to deal with relative paths, because it will get quite
cumbersome
when deep-linking of folders occurs.
Relative views/admin/index.js
require("../../lib/core/strap.js")
Instead you reference strap.js via:
require("strap");
Kinda like adding folders to require() so that it understands how to deal
with them.
require.paths(["lib/core", "lib/route"]);
--application without resulting to absolute/relative paths.
Say you have your standard lib setup:
lib/core/strap.js
lib/route/route.js
Say you have your standard views setup:
views/admin/index.js
views/a/deep/link/index.js
You do not want to deal with relative paths, because it will get quite
cumbersome
when deep-linking of folders occurs.
Relative views/admin/index.js
require("../../lib/core/strap.js")
Instead you reference strap.js via:
require("strap");
Kinda like adding folders to require() so that it understands how to deal
with them.
require.paths(["lib/core", "lib/route"]);
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
nodejs+[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en