https://github.com/socketstream/ss-coffeekup
CoffeeKup template engine wrapper providing server-side compiled templates for SocketStream apps
https://github.com/socketstream/ss-coffeekup
Last synced: 4 months ago
JSON representation
CoffeeKup template engine wrapper providing server-side compiled templates for SocketStream apps
- Host: GitHub
- URL: https://github.com/socketstream/ss-coffeekup
- Owner: socketstream
- Created: 2012-02-01T17:06:41.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2012-04-10T17:59:01.000Z (about 14 years ago)
- Last Synced: 2025-11-27T10:45:49.104Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 107 KB
- Stars: 8
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
Awesome Lists containing this project
README
# 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:
```javascript
ss.client.templateEngine.use(require('ss-coffeekup'));
```
Restart the server. From now on all templates will be pre-compiled and accessibale via the `ss.tmpl` object.
### Usage
A template placed in
/client/templates/offers/latest.coffee
Can be rendered in your browser with
```javascript
// assumes var ss = require('socketstream')
var html = ss.tmpl['offers-latest']({name: 'Special Offers'})
```
### 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:
```javascript
ss.client.templateEngine.use(require('ss-coffeekup'), '/ck-templates');
```