Permalink
Browse files

brequire can now handle non-relative paths e.g. require('lib')

  • Loading branch information...
weepy@github.com weepy@github.com
weepy@github.com authored and weepy@github.com committed Dec 9, 2010
1 parent e5f153b commit dac22f79ce3d36ed617f14496b7ec110d75b47af
Showing with 5 additions and 2 deletions.
  1. +0 −1 Tutorial
  2. +5 −1 lib/brequire.js
View
@@ -12,4 +12,3 @@ how to use
limitations
links
-
View
@@ -15,6 +15,8 @@ require.modules = {};
require.bind = function(path) {
return function(p) {
+ if(!p.match(/^\./)) return require(p)
+
var fullPath = path.split('/');
fullPath.pop();
var parts = p.split('/');
@@ -31,8 +33,10 @@ require.module = function(path, fn) {
require.modules[path] = fn;
};
+
+
require.compile = function(file, text) {
- return "require.module('./" + file + "', function(module, exports, require) {\n// start module: " + file + "\n\n" + text + "\n\n// end module: "+ file +"\n});\n"
+ return "require.module('" + file + "', function(module, exports, require) {\n// start module: " + file + "\n\n" + text + "\n\n// end module: "+ file +"\n});\n"
}
if(typeof exports != "undefined") {

0 comments on commit dac22f7

Please sign in to comment.