finish keyboard pass

This commit is contained in:
Kevin Ngo
2018-07-20 15:42:47 +02:00
parent 86f0ad5641
commit 29523e290e
12 changed files with 211 additions and 152 deletions

View File

@@ -10,11 +10,12 @@ var webpack = require('webpack');
var nunjucks = Nunjucks.configure(path.resolve(__dirname, 'src'), {
noCache: true,
});
nunjucks.addGlobal('DEBUG_KEYBOARD', !!process.env.DEBUG_KEYBOARD);
nunjucks.addGlobal('HOST', ip.address());
nunjucks.addGlobal('IS_PRODUCTION', process.env.NODE_ENV === 'production');
// Initial Nunjucks render.
var context = {IS_PRODUCTION: process.env.NODE_ENV === 'production'};
fs.writeFileSync('index.html', nunjucks.render('index.html', context));
fs.writeFileSync('index.html', nunjucks.render('index.html'));
// For development, watch HTML for changes to compile Nunjucks.
// The production Express server will handle Nunjucks by itself.
@@ -24,7 +25,7 @@ if (process.env.NODE_ENV !== 'production') {
return;
}
try {
fs.writeFileSync('index.html', nunjucks.render('index.html', context));
fs.writeFileSync('index.html', nunjucks.render('index.html'));
} catch (e) {
console.error(e);
}