🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

foobars

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

foobars

Small and simple JS templating engine

latest
Source
npmnpm
Version
0.0.8
Version published
Weekly downloads
16
Maintainers
1
Weekly downloads
 
Created
Source

FooBars

Small and fast coffeescript template library. Works as express middleware.

To parse:

FooBars = require('FooBars').parse

FooBars('PATH_TO_FILE.html',{
  myData:'Goes Here',
  can:function(){
    'also be a function'
  }
},optionalCallback)

FooBars will run callback with 2 paramaters. Error and HTML. If no callback is supplies, FooBars will return data in a Synchronous fassion.

Template Syntax:

###Sample data to be passed

{
  a:function(){return 'a'},
  b:function(){return 'b'},
  friends:['Jonnie', 'Matt']
}

###If

<if 'a' == a() || function(){ return 'a' }>
  <h1>Turns out 'a' is equal to 'a'</h1>
</if>
<h1>Turns out 'a' is qual to 'a'</h1>

###Each

<each of='this.friends'>
  <h1>I like {{name}}, he is my friend.</h1>
</each>
<h1>I like Jonnie, he is my friend.</h1>
<h1>I like Matt, he is my friend.</h1>

###Templates

<template name='home'>
  <h1>Template Code</h1>
</template>


<show name='home'></show> <!-- Load Template -->

FAQs

Package last updated on 15 Nov 2014

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