mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
update webawesome simulation to be closer to the app. (#1789)
* update webawesome simulation to be closer to the app. * prettier
This commit is contained in:
@@ -1,10 +1,20 @@
|
|||||||
|
import * as path from 'node:path';
|
||||||
import nunjucks from 'nunjucks';
|
import nunjucks from 'nunjucks';
|
||||||
|
|
||||||
|
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.
|
* This function simulates what a server would do running "on top" of eleventy.
|
||||||
*/
|
*/
|
||||||
export function SimulateWebAwesomeApp(str) {
|
export function SimulateWebAwesomeApp(str) {
|
||||||
return nunjucks.renderString(str, {
|
return nunjucksEnv.renderString(str, {
|
||||||
// Stub the server EJS shortcodes.
|
// Stub the server EJS shortcodes.
|
||||||
currentUser: {
|
currentUser: {
|
||||||
hasPro: false,
|
hasPro: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user