ncahec-northwest-theme
Version:
theme for northwest ahec
36 lines (34 loc) • 1.22 kB
JavaScript
const fs = require('fs');
const axios = require('axios');
module.exports = {
loadCg3Template: async () => {
return new Promise(async (resolve, reject) => {
try {
console.log("loading cg3 template");
const domain = 'northwestahec'; //env.isProduction ? "northwestahec" : "dev.northwestahec";
const cg3HeadContent = await axios.get(
`https://${domain}.wakehealth.edu/cg3/build/index-inner-head.html`
);
const cg3BodyContent = await axios.get(
`https://${domain}.wakehealth.edu/cg3/build/index-inner-body.html`
);
tmp2 = fs.readFileSync('./dist/index.html','utf8')
cg3template = tmp2.replace(
"<ncahec-component></ncahec-component>",
`<div class="main container northwest"><base href="/cg3" />${cg3HeadContent.data.replace(
/\/static/g,
"/cg3/build/static"
)}${cg3BodyContent.data.replace(
/\/static/g,
"/cg3/build/static"
)}</div>`
);
console.log("loaded cg3 template");
resolve(cg3template);
} catch (error) {
console.log("unable to load cg3 template");
reject(error);
}
});
},
};