@tarik02/bladejs
v3.0.0
Published
Laravel's blade templating engine for JavaScript and TypeScript.
Downloads
2
Readme
bladejs
Installation
$ yarn add @tarik02/bladejs
# or
$ npm install --save @tarik02/bladejs
Usage
import {
CompiledTemplate,
Runtime,
TemplateProvider,
} from '@tarik02/bladejs';
const templateProvider: TemplateProvider = {
async getTemplateCompiledFile(name: string): Promise<CompiledTemplate | undefined> {
// TODO: Load template, return undefined if does not exist
},
async isOutdated(name: string, template: CompiledTemplate, creationTime: number): Promise<boolean> {
// TODO: Return true if template is outdated (this will cause to {getTemplateCompiledFile} call)
},
};
const runtime = new Runtime([templateProvider]);
(async () => {
for await (const chunk of runtime.render('test')) {
process.stdout.write(chunk);
}
})();