Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/lib/output/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,21 @@ export class Renderer extends ChildableComponent<Application, RendererComponent>
}
}

this.theme = this.addComponent('theme', new DefaultTheme(this, path));
const filename = Path.join(path, 'theme.js');
if (!FS.existsSync(filename)) {
this.theme = this.addComponent('theme', new DefaultTheme(this, path));
} else {
try {
const themeClass = typeof require(filename) === 'function' ? require(filename) : require(filename).default;

this.theme = this.addComponent('theme', new (themeClass)(this, path));
} catch (err) {
throw new Error(
`Exception while loading "${filename}". You must export a \`new Theme(renderer, basePath)\` compatible class.\n` +
err
);
}
}
}

this.theme.resources.activate();
Expand Down