Skip to content

Commit e2fd44d

Browse files
committed
feat(platform-views): give root option to the engine to fix Eta views dir support
1 parent 11eff10 commit e2fd44d

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

packages/platform/platform-views/src/domain/PlatformViewsSettings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const PLATFORM_VIEWS_EXTENSIONS = {
77
dot: "dot",
88
dust: "dust",
99
ect: "ect",
10+
eta: "eta",
1011
ejs: "ejs",
1112
haml: "haml",
1213
"haml-coffee": "haml-coffee",

packages/platform/platform-views/src/services/PlatformViews.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ describe("PlatformViews", () => {
4646
cache: false,
4747
alter: "alter",
4848
global: "global",
49-
requires: "requires"
49+
requires: "requires",
50+
root: expect.any(String)
5051
});
5152
});
5253
it("should render a template without extension", async () => {
@@ -63,7 +64,8 @@ describe("PlatformViews", () => {
6364
global: "global",
6465
test: "test",
6566
alter: "alter",
66-
requires: "requires"
67+
requires: "requires",
68+
root: expect.any(String)
6769
});
6870
});
6971
it("should render a template without extension", async () => {

packages/platform/platform-views/src/services/PlatformViews.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,17 @@ export class PlatformViews {
129129
throw new Error(`Engine not found to render the following "${viewPath}"`);
130130
}
131131

132-
const finalOpts = Object.assign({cache: this.cache || this.env === Env.PROD}, engine.options, options, {$ctx});
132+
const finalOpts = Object.assign(
133+
{
134+
cache: this.cache || this.env === Env.PROD
135+
},
136+
engine.options,
137+
options,
138+
{
139+
$ctx,
140+
root: this.root
141+
}
142+
);
133143

134144
return engine.render(path, finalOpts);
135145
}

0 commit comments

Comments
 (0)