I am trying to use pug on electron.
I have a question my second .pug
file is not rendered correctly, it just output the pug code itself.
First I have this main pug file that was loaded by the main.js
doctype
html(lang='en')
head
meta(charset='utf-8')
title HIMS
body
div(id="app")
script.
require('./index.js')
then the index.js will just call the login.js
const fs = require('fs');
const path = require('path');
var link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('href', path.join(__dirname, 'style.css'));
document.head.appendChild(link);
const login = path.join(__dirname, 'login.pug');
fs.readFile(login, 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
document.getElementById('app')
.innerHTML = data;
});
but the .innerHTML
will just output the pug code itself.
Please help how I can fix. I will appreciate any advice or hint will come, thanks.