Skip to content

Commit

Permalink
feat: compile frontend templates on init
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Feb 6, 2023
1 parent 9d23735 commit 5e5fb12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/core/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { UINode } from './../@types/core';
import { compile } from '../engine/compile';
import render from '../engine/render';
import { directives } from './directives';
import template from './../engine/template';

export default class Component {
public uiNodes: UINode[] = [];
Expand All @@ -16,11 +17,11 @@ export default class Component {
? el
: document.querySelector<HTMLElement>(el) || document.body;

template.findAll(rootEl).map(el => el.compile());
this.uiNodes = compile(rootEl);

this.render();

// @ts-expect-error
rootEl['component'] = this;

return this;
Expand Down

0 comments on commit 5e5fb12

Please sign in to comment.