npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

kabam-plugin-hogan

v0.1.0

Published

MWC core plugin to add support for hogan express template engine

Downloads

3

Readme

kabam-plugin-hogan Build Status

Kabam plugin to add support for hogan-express template engine utilizing hogan.js.

Installing

  1. Read the documentation on syntax
  2. Install plugin from github or npm
  3. Include plugin as kabam.usePlugin('kabam-plugin-hogan');
  4. Create directory of views with templates - see example for details
  5. When you issue render function on response object in route of ExpressJS application, the view is rendered by hogan

Example


var kabamKernel = require('kabam-kernel');
var kabam = kabamKernel(require('./config.json')[(process.env.NODE_ENV) ? (process.env.NODE_ENV) : 'development']);

kabam.usePlugin(require('kabam-plugin-hogan'));

kabam.extendApp(function(core) { //setting variables accessible in all templates
  core.app.locals.viewEngine = 'hogan'; //http://expressjs.com/api.html#app.locals
});

kabam.extendRoutes(function(core) {
  core.app.get('/', function(req, res) {
    res.render('index/index', {
      'title': 'Hello, world!',
      'content': 'This application uses template engine!'
    });
  });

  core.app.get('/withOutLayout', function(req, res) {
    res.type('txt');
    res.render('index/index', {
      'title': 'Hello, world!',
      'layout': false, //we turning off the layout part of template
      'content': 'This application uses template engine!',
      'time': (new Date()).toLocaleTimeString()
    });
  });

  core.app.get('/withPartials', function(req, res) {
    res.render('index/index', {
      'title': 'Hello, world!',
      'partials': {
        timePartial: 'index/partials/_currentTime'
      }, //we use partials
      'content': 'This application uses template engine!',
      'time': (new Date()).toLocaleTimeString()
    });
  });
});

kabam.start();

Contents of view folder:


`views/`
  `index/`
    `partials/`
      `_currentTime.html`
    `index.html`
  `layout.html`

Mustache syntax

http://mustache.github.io/mustache.5.html

Why use mustache?

  1. Simple syntax
  2. High speed
  3. Yandex and Twitter used it
  4. You can render html, rss, xml, docx and whatever want.

Test


# Install the dependencies
$ npm install

# Run the test runner
$ npm test

Configuring

This plugin has a way to include css and javascript files URL in layout file.


kabam.extendApp(kabam) {
  kabam.app.locals.css.push({url: '//yandex.st/bootstrap/2.3.2/css/bootstrap.min.css'});
  kabam.app.locals.javascripts.push({url: '//yandex.st/bootstrap/2.3.2/js/bootstrap.min.js', async: true});
};

Responsibility guidelines

Every kabam plugin and package has the responsible developer. His duties are

  • Maintain the package - fix and find bugs from upgrading modules included or nodejs version changing
  • React on bug reports
  • Accept/deny pull request.

The Push and npm publish privilege is the right of the Responsible developer, but the fork - is for everybody.

Responsible developer for this package is Anatolij Ostroumov