Socket
Socket
Sign inDemoInstall

bogus.js

Package Overview
Dependencies
2
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bogus.js

Access Backbone templates from Hogan


Version published
Weekly downloads
4
increased by300%
Maintainers
1
Install size
1.72 MB
Created
Weekly downloads
 

Readme

Source

Bogus.js = Hogan.js + Backbone.js Build Status

Bogus.js extends Hogan.js with support for Backbone.js models. This means that mustache {{tags}} will look for Backbone.Model attributes, and mustache {{#sections}} will iterate over Backbone.Collections.

From the browser

Bogus.js is tied to a specific version of Hogan.js, currently 2.0.0. You will probably want one of the following builds:

Make sure Hogan.js and Bogus.js are included in your page in order:

<script src="underscore.js"></script>
<script src="backbone.js"></script>
<script src="hogan.js"></script>
<script src="bogus.js"></script>

From Node.js

Install using NPM:

$ npm install bogus.js

Then simply:

var Bogus = require('bogus.js');

Usage

The Bogus namespace contains all the methods you'd normally find in the Hogan namespace. This means you can simply:

var data = new Backbone.Model({
  screenName: "ko_si_nus",
});

var template = Bogus.compile("Follow @{{screenName}}.");
var output = template.render(data);

// prints "Follow @ko_si_nus."
console.log(output);

Keywords

FAQs

Last updated on 21 Mar 2012

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc