Last active
December 15, 2015 13:59
-
-
Save Nayjest/5270915 to your computer and use it in GitHub Desktop.
Jade 'extends' or 'include' in browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof window !== 'undefined') { | |
/** | |
* client based path.js | |
* | |
*/ | |
require.register("path.js", function(module, exports, require){ | |
var list = []; | |
module.exports = { | |
dirname : function(path) { | |
path = path || ""; | |
var arr = path.split("/"); | |
arr.pop(); | |
return arr.join("/"); | |
}, | |
basename : function(path) { | |
path = path || ""; | |
var arr = path.split("/"); | |
return arr.pop(); | |
}, | |
join : function() { | |
var list = []; | |
for(var i = 0, len = arguments.length; i < len; i++) { | |
list.push(arguments[i]); | |
} | |
return list.join("/"); | |
} | |
} | |
}) | |
/** | |
* client based fs.js | |
* | |
*/ | |
require.register("fs.js", function(module, exports, require){ | |
module.exports = { | |
readFileSync : function (filename, encoding) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', filename, false); | |
xhr.send(null); | |
return xhr.responseText; | |
} | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Paste it inside jade.js