Wondering what’s next for npm?Check out our public roadmap! »

    @justeat/f-templates

    1.5.1 • Public • Published

    f-templates 🐻

    npm version Build Status

    About

    The purpose of this module is to copy a JavaScript module into your web project which can locate, compile, and serve HTML from templates. This is achieved by using the gulp-build-fozzie copy:assets task.

    Adding f-templates to your project

    Add the module to your dependencies

    yarn add @justeat/f-templates

    Once the module has been copied into your project (via the gulp-build-fozzie copy:assets task) you can use it in the following ways.

    Node

    Require and call the imported module:

    const templates = require('./templates');
     
    const html = templates.getTemplate(callback, moduleName, language, options);

    .Net Core

    If you are using the NodeServices NuGet package then you can call it like this:

    public async Task<IActionResult> MyAction([FromServices] INodeServices nodeServices)
    {
        var result = await nodeServices.InvokeExportAsync<string>("./templates", getTemplate, templateName, language, options);
        return new HtmlString(result);
    }

    Parameters

    • callback is a function which should be called upon completion. This is not required when using NodeServices in .Net Core.

    • moduleName is the name of the template file which you would should be used to generate the HTML.

    • language is a string containing the country code for the language you'd like the templates to compile with e.g. "fr-CA" for French Canadian.

    • options is an optional parameter in which you can pass parameters which will be used in the template.

    Keywords

    Install

    npm i @justeat/f-templates

    DownloadsWeekly Downloads

    42

    Version

    1.5.1

    License

    Apache-2.0

    Unpacked Size

    134 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar