I hereby claim:
- I am skeate on github.
- I am skeate (https://keybase.io/skeate) on keybase.
- I have a public key ASAPiJ3LR-xVyxGOnXl_bKoL2z0kycl9QUZhe_tacTvqxAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Object.prototype.if = function(cond) { | |
var self = this; | |
var wrapFunc = function(f) { | |
return function() { | |
if (cond) { | |
return f.apply(self, arguments); | |
} else { | |
return self; | |
} | |
}; |
var _ = require("underscore")._; | |
var fs = require("fs"); | |
fs.readdir(".", function(err,files){ | |
fs.writeFileSync('./templates.js',"templates={};"+ | |
files | |
.filter(function(f){return f.substr(-5) == ".html"}) | |
.map(function(f){return {name:'templates["'+f.substr(0,f.length-5)+'"]',source:fs.readFileSync(f).toString()};}) | |
.map(function(s){return s.name+"="+_.template(s.source).source+";";}) | |
.join('') |