16 lines
490 B
JavaScript
16 lines
490 B
JavaScript
require = require("../require-polyfill")(require.valueOf());
|
|
|
|
var fs = require("fs");
|
|
|
|
module.exports = function(template, filesReq, stdout, prefix) {
|
|
|
|
var regexp = new RegExp("\\{\\{" + (prefix ? prefix+":" : "") + "([^:\\}]+)\\}\\}", "g")
|
|
|
|
return template.replace(regexp, function(match) {
|
|
match = match.substr(2 + (prefix ? prefix.length+1 : 0), match.length - 4 - (prefix ? prefix.length+1 : 0));
|
|
if(match === "stdout")
|
|
return stdout;
|
|
return filesReq("./" + match);
|
|
});
|
|
|
|
} |