Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit dac22f79ce3d36ed617f14496b7ec110d75b47af 1 parent e5f153b
weepy@github.com authored
Showing with 5 additions and 2 deletions.
  1. +0 −1  Tutorial
  2. +5 −1 lib/brequire.js
View
1  Tutorial
@@ -12,4 +12,3 @@ how to use
limitations
links
-
View
6 lib/brequire.js
@@ -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") {
Please sign in to comment.
Something went wrong with that request. Please try again.