forked from MadeByMike/html5-periodic-table
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
26 lines (20 loc) · 870 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var fs = require('fs');
var layout = require('periodic-layout');
var Handlebars = require('handlebars');
var sass = require('node-sass');
var elements = require('./src/elements.json');
var fblock = require('./src/f-block.json');
var keys = require('./src/keys.json');
var aspect = '9x6';
var rows = layout(elements, aspect);
var css = sass.renderSync({ data: fs.readFileSync('./src/main.scss').toString() }).css.toString();
var doc_template = Handlebars.compile(fs.readFileSync('./src/doc.html').toString());
var element_template = Handlebars.compile(fs.readFileSync('./src/elements.html').toString());
var content = element_template({"elements":rows, "fblock": fblock, 'keys':keys});
var output = doc_template({'content': content, 'css': css});
fs.writeFile("index.html", output, function(err) {
if(err) {
return console.log(err);
}
return 'Done!';
});