const nunjucks = require('nunjucks');
const fs = require('fs');
const yaml = require('js-yaml');

const ENTRY_POINT='templates/index.njk';
const OUTPUT_POINT='public/index.html';
const GLOBAL_SETTINGS='./settings.yml';

try {
	    let fileContents = fs.readFileSync(GLOBAL_SETTINGS, 'utf8');
	    let settings = yaml.safeLoad(fileContents);

      var data = nunjucks.render(ENTRY_POINT, settings);
      fs.writeFile(OUTPUT_POINT, data, 'utf-8');

} catch (e) {
	    console.log(e);
}


