• Docs

Getting Started

  1. Introduction

CLI

  1. General

    1. Installation
    2. Commands
    3. Scaffold a new project
    4. Generate a new component
    5. Install a component
  2. Generators

    1. Veams Generator

Framework

  1. Base

    1. Base Class
    2. Component Class
    3. Core
    4. Helpers
  2. Plugins

    1. Overview
    2. Logger
    3. Modules
    4. Media Query Handler
    5. Store
    6. Templater
    7. Vent
  3. Other Packages

    1. Http-Service

Methodology

  1. General

    1. Overview
  2. Instruments

    1. Regions
    2. Components
    3. Utilities
  3. Classes and Markup

    1. Introduction
    2. Global Styling
    3. Context Styling
    4. Modifier Styling
  4. JavaScript

    1. Modules
    2. Items
    3. Options
    4. Bringing It All Together

Veams Templater Plugin (@veams/plugin-templater)

This plugin adds the possibility to render your handlebars templates in an easy way. You can register the engine, templates, partials and helpers and use them directly in other classes.

TypeScript is supported.


Installation

NPM

npm install @veams/plugin-templater --save

Yarn

yarn add @veams/plugin-templater

Usage

import Veams from '@veams/core';
import TemplaterPlugin from '@veams/plugin-templater';
import handlebars from 'handlebars/runtime';
import { templates } from './templates';
import { customHelper } from './helpers';

// Intialize core of Veams
Veams.onInitialize(() => {
   	// Add plugins to the Veams system
	
    // Add plugins to the Veams system
    Veams.use(TemplaterPlugin, {
        engine: handlebars,
        templates: templates,
        helpers: [
            customHelper
        ]
    });
});

Options

Option Type Default Description
engine {Function} [null] Provide the handlebars engine instance.
templates {Function} [null] Provide your precompiled handlebars templates.
partials {Function} [null] You can provide additional partials.
helpers {Array} [[]] Add custom handlebars helpers.

API

When enabled you can render your template by simple executing the Veams.templater.render():

// Render the template
$(body).append(
    Veams.templater.render('test-template', {data: 'custom data passed to partial'})
);
If you've spotted a typo or a mistake, or wish to add something on, you could write about this on Github | Gitter | © Made in Berlin with love