Code Monkey home page Code Monkey logo

foobars's Introduction

FooBars

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

npm install foobars

With Express:

app.set 'view engine', 'html'
app.engine 'html', require('foobars').parse

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 -->

foobars's People

Contributors

isnit0 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.