update webawesome simulation to be closer to the app.

This commit is contained in:
konnorrogers
2025-11-18 12:18:29 -05:00
parent 86293cc3e1
commit e155176295

View File

@@ -1,10 +1,25 @@
import nunjucks from 'nunjucks';
import * as path from "node:path"
const baseDir = process.env.BASE_DIR || "docs"
const views = [
path.join(baseDir),
path.join(baseDir, '_layouts'),
path.join(baseDir, '_includes')
];
const nunjucksEnv = new nunjucks.Environment(new nunjucks.FileSystemLoader(views), {
autoescape: true,
noCache: process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test'
});
/**
* This function simulates what a server would do running "on top" of eleventy.
*/
export function SimulateWebAwesomeApp(str) {
return nunjucks.renderString(str, {
return nunjucksEnv.renderString(str, {
// Stub the server EJS shortcodes.
currentUser: {
hasPro: false,