compile.js 577 B

1234567891011121314151617
  1. var fs = require("fs");
  2. var base = fs.readFileSync('base.html').toString();
  3. ['top','bottom'].forEach(function(v){
  4. ['left','right'].forEach(function(h){
  5. ['1','2','3','4','5'].forEach(function(t){
  6. var text = fs.readFileSync('t' +t+'.html').toString();
  7. var outFile = 'out/' + t +v.charAt(0) + h.charAt(0) + '.html';
  8. var out = base
  9. .replace(/\{\{\{t\}\}\}/g,text)
  10. .replace(/\{\{v\}\}/g,v)
  11. .replace(/\{\{h\}\}/g,h);
  12. fs.writeFileSync(outFile, out);
  13. });
  14. });
  15. });