Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hmpo-template-mixins

Package Overview
Dependencies
Maintainers
4
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hmpo-template-mixins

A middleware that exposes a series of Mustache mixins on res.locals to ease usage of forms, translations, and some general needs.

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
110
increased by71.88%
Maintainers
4
Weekly downloads
 
Created
Source

passports-template-mixins

A middleware that exposes a series of Mustache mixins on res.locals to ease usage of forms, translations, and some other things.

It takes in two arguments, a fields object containing field configuration, and an options object.

Installation

npm install [--save] hmpo-template-mixins;

Usage

var express = require('express');

var i18n = require('i18n-future');

var fields = require('./routes/renew-your-passport/fields');

app.set('view engine', 'html');
app.set('views', path.join(__dirname, '/views'));

app.use(i18n.middleware());
app.use(require('hmpo-template-mixins')(fields, { sharedTranslationsKey: 'passport.renew' }));

app.use(function (req, res) {
    // NOTE: res.locals.partials has been set.

    res.render('example-template');
});

Translation

By default any function set to req.translate will be used for translation if it exists. For example, that generated using i18n-future middleware.

Options

viewsDirectory

Allows you override the directory that the module checks for partials in - Default: the root of this project

viewEngine

Allows you to alter the file extension of the templates - Default: 'html'

sharedTranslationsKey

Prefixes keys for translation - Default: ''

translate

Defines a custom translation method - Default: req.translate

Mustache mixins available

t
time
selected
lowercase
uppercase
hyphenate
date
currency
select
input-text
input-date
input-text-compound
input-text-code
input-number
input-phone
radio-group
checkbox
checkbox-compound
checkbox-required
input-submit
textarea

Keywords

FAQs

Package last updated on 16 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc