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

fs-hogan

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-hogan

Fork of hogan.js that falls back to file system for partials.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

fs-hogan

fs-hogan is a fork of Hogan.js, a fast mustache-compatible templating engine that supports template inheritance (supers), a feature that may make it into the official spec for mustache v2.0.0. The goal of fs-hogan is to take advantage of Hogan.js while also making rendering templates from the file system a breeze.

Installation

$ npm install fs-hogan

Usage

Require

var hogan = require('fs-hogan');

Options

  • cache: if true, fs-hogan will cache file templates after they are read from disk. [default: false]
  • templates: the path fs-hogan will look for templates in. [default: 'views']
  • extension: the file extension used for templates. [default: 'hjs']

In addition to these options, fs-hogan also supports the compilation options of Hogan.js.

API

hogan.set(option, value)

Sets option to value. To set multiple options at once, you can pass in an object that maps keys to options. Returns hogan so you can configure fs-hogan while requiring it.

hogan.renderFile(path, [context], [callback])

Asynchronously renders the template that exists at path with the context provided by context and then calls callback with 2 arguments: err and text.

When path is a relative path, templates will be used as the base path.

Example

A working example of fs-hogan exists in the /examples directory.

Express

fs-hogan works great with Express.

var express = require('express');
var hogan = require('fs-hogan');

var app = express();

app.configure(function() {
  app.set('views', __dirname + '/views');
  app.set('view engine', 'hjs');                                                
  hogan.set({ templates: app.get('views'), extension: app.get('view engine') });
  app.engine('hjs', hogan.renderFile);
});

Issues

Found a bug? Create an issue on GitHub.

https://github.com/jharding/fs-hogan/issues

Versioning

For transparency and insight into the release cycle, releases will be numbered with the follow format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

  • Breaking backwards compatibility bumps the major
  • New additions without breaking backwards compatibility bumps the minor
  • Bug fixes and misc changes bump the patch

For more information on semantic versioning, please visit http://semver.org/.

License

Copyright (c) 2012 Jake Harding
Licensed under the MIT License.

Keywords

FAQs

Package last updated on 19 Sep 2012

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