Merge pull request #275 from rickyvetter/wrapPagesHTML

add wrapPagesHTML which renders html snippets in pages inside of a header + footer
This commit is contained in:
Ricky Vetter 2017-12-20 10:05:21 -08:00 committed by GitHub
commit ce338fff64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View file

@ -371,7 +371,19 @@ function execute(port) {
))
)
) {
res.send(fs.readFileSync(htmlFile, {encoding: 'utf8'}));
if (siteConfig.wrapPagesHTML) {
removeModuleAndChildrenFromCache("../core/Site.js");
const Site = require("../core/Site.js");
const str = renderToStaticMarkup(
<Site language="en" config={siteConfig}>
<div dangerouslySetInnerHTML={{__html: fs.readFileSync(htmlFile, { encoding: "utf8" })}} />
</Site>
);
res.send(str);
} else {
res.send(fs.readFileSync(htmlFile, { encoding: "utf8" }));
}
return;
}