🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

handlebars-helper-url

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars-helper-url

Handlebars helper that format urls depending on the environment

1.0.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

handlebars-helper-url

Handlebars helper that format urls depending on the environment. This plugin is used along with metalsmith-metadata.

Installation

npm install handlebars-helper-url

Usage

Refer to metalsmith-metadata to know more, but basically you need to create your metadata as a YAML file in the root of your sources directory:

// globals.yaml

author:
  name: Antonio Hernández
  email: ahdiaz [at] gmail

site:
  title: Work in progress
  url:
    devel: /
    prod: http://ahdiaz.euler.es/

In your metalsmith script:

var handlebars = require('handlebars');
var metadata = require('metalsmith-metadata');
var hbturl = require('handlebars-helper-url')(handlebars);

new Metalsmith(__dirname)
    .use(metadata({
      globals: './path/to/globals.json'
    }))
    .build();

When you build your site the urls will be relatives or absolutes to your site depending on the specified environment:

$ NODE_ENV=production node index.js

handlebars Object

A Handlebars instance.

License

MIT License, see LICENSE for details.

Keywords

metalsmith

FAQs

Package last updated on 02 Nov 2016

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