@hidoo/express-engine-handlebars

    0.8.2 • Public • Published

    @hidoo/express-engine-handlebars

    Handlebars template engine for express.

    Installation

    $ npm install --save express @hidoo/express-engine-handlebars

    Usage

    import express from 'express';
    import expressEngineHandlebars from '@hidoo/express-engine-handlebars';
    
    const app = express();
    
    app.set('view engine', 'hbs');
    app.set('views', '/path/to/views');
    app.engine('hbs', expressEngineHandlebars({
      layouts: '/path/to/views/layouts/**/*.hbs',
      partials: '/path/to/views/partials/**/*.hbs',
      helpers: '/path/to/views/helpers/**/*.js'
    }));

    Registering Helpers

    example:

    export const register = (handlebars) => {
      handlebars.registerHelper('wrapBrackets', (value) =>
        new handlebars.SafeString(`[[ ${value} ]]`)
      );
    };

    Test

    $ yarn test

    License

    MIT

    Install

    npm i @hidoo/express-engine-handlebars

    DownloadsWeekly Downloads

    32

    Version

    0.8.2

    License

    MIT

    Unpacked Size

    18.7 kB

    Total Files

    6

    Last publish

    Collaborators

    • hidoo