config: fix building of index.html in watch mode (do not cache data.json)
This commit is contained in:
parent
21ac8602ff
commit
19c11312c5
|
@ -1,10 +1,11 @@
|
||||||
const handlebars = require('handlebars');
|
const handlebars = require('handlebars');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const data = require('./data');
|
|
||||||
const packageJson = require('../package');
|
const packageJson = require('../package');
|
||||||
|
|
||||||
function compile(isDevMode = false) {
|
function compile(isDevMode = false) {
|
||||||
|
const dataPath = path.resolve(__dirname, 'data.json');
|
||||||
|
const data = JSON.parse(fs.readFileSync(dataPath).toString());
|
||||||
const templatePath = path.resolve(__dirname, 'index.html.handlebars');
|
const templatePath = path.resolve(__dirname, 'index.html.handlebars');
|
||||||
const template = fs.readFileSync(templatePath).toString();
|
const template = fs.readFileSync(templatePath).toString();
|
||||||
const delegate = handlebars.compile(template);
|
const delegate = handlebars.compile(template);
|
||||||
|
|
Loading…
Reference in New Issue