0.0.1-beta.0 • Published 5 years ago

curli-templates-module v0.0.1-beta.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

curli-templates-module

Templates for the Curli framework.

Build Status

Installation

Install by npm

npm install --save curli-templates-module

Basic Usage

1 - In the configurations file, declare de followings properties:

@TEMPLATE_EXTENSIONS: (Array) A list of extension, should be 'hbs', 'handlebars'. @TEMPLATE_USE_FILE_PATH_IN_ID (boolean) If we want add the path to the file into the id.

2 - Add the module definer:

import {TemplatesModuleDefiner} from "curli-templates-module";

app.addModulesDefiner(new TemplatesModuleDefiner(app));

3 - Attach templates paths to the service

public registerTemplates(templatesService: TemplatesService): void {
    dataMappers.registerPath({path: 'templates/'});
}

4 - Compile the template

await this.container.get('templates').compile('user', {"name": "John"})

Commands

  • npm run build: Build the project (Curli templating).
  • npm run build:clean: Delete first the dist folder and build it.
  • npm run clean: Delete the dist folder.
  • npm run test: Execute the tests.
  • npm run test:coverage: Execute the tests and calculate the coverage.
  • npm run lint: Check the code using the rules in .eslintre.js
  • npm run lint:fix: Check the code and try to fix it.

License

MIT