0.1.2 • Published 12 years ago

ss-coffeekup v0.1.2

Weekly downloads
22
License
-
Repository
github
Last release
12 years ago

CoffeeKup Template Engine wrapper for SocketStream 0.3

http://coffeekup.org

Use pre-compiled CoffeeKup client-side templates in your app.

Installation

Add ss-coffeekup to your application's package.json file and then add this line to app.js:

ss.client.templateEngine.use(require('ss-coffeekup'));

Restart the server. From now on all templates will be pre-compiled and attached to the CT window/global variable.

Usage

A template placed in

/client/templates/offers/latest.html  (note the .html extension)

Can be rendered in your browser with

html = CT['offers-latest']({name: 'Special Offer'})

Note

CoffeeKup templates do not require a VM or any other client-side library as each template is turned into pure JS code. This is great for convenience and performance, but can result in a lot of code being sent to the client vs other template solutions if your app has many templates.

Improvements and forks welcome.

Options

When experimenting with CoffeeKup, or converting an app from one template type to another, you may find it advantageous to use multiple template engines and confine use of CoffeeKup to a sub-directory of /client/templates.

Directory names can be passed to the second argument as so:

ss.client.templateEngine.use(require('ss-coffeekup'), '/ck-templates');

To specify another global/window variable instead of CT set the 'namespace' option in the config as so:

ss.client.templateEngine.use(require('ss-coffeekup'), '/', {namespace: 'MyVar'});
0.1.2

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago