Giter Site home page Giter Site logo

node-cfml's Introduction

node-cfml

A simple cfml template engine for node.js/express

Quick-Start Guide

Introduction

Version 1.0 is out! It's a complete rewrite of what started out as a few regexps quickly thrown together. It is now a decently fast template engine. It uses a static cache, it supports tag nesting, comments, dynamic variable names, etc. It behaves mostly like Coldfusion but it interprets javascript code. (eg: arrays start at 0). Just use it like you would any other express template engine. Enjoy the clean views, the tag completion and color coding ... Using tags for view logic in HTML actually kicks ass.

Support

Only a few CFML tags have been implemented. It wouldn't make sense to use most other CF tags in a view. The implemented tags are:

  • CFSET
  • CFOUTPUT
  • CFIF
  • CFLOOP
  • CFPARAM
  • CFSAVECONTENT
  • CFINCLUDE
  • CFBREAK
  • CFABORT

The implemented CF operators are:

  • EQ, IS
  • NEQ, IS NOT
  • LT
  • GT
  • LTE, LE
  • GTE, GE
  • NOT
  • AND, OR
  • MOD
  • &

You can also use javascript operators directly. The parser will not like the > operator in tags so use GT or GTE in a CFIF tag.

Installation

npm install node-cfml --save

You're now setup

Usage

var express = require('express')
var app = express()
var cfml = require('node-cfml')

app.engine('cfm', cfml.renderFile)
app.set('view engine', 'cfm')
app.get('/', function (req, res) {
  res.render('test.cfm')
})

var server = app.listen(3000, function () {
  var host = server.address().address
  var port = server.address().port

  console.log('Example app listening at http://%s:%s', host, port)
})

Tests

Run the following command to run the project tests

mocha

node-cfml's People

Contributors

lafougere avatar

Watchers

James Cloos avatar Andrew Kralovec 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.