https://github.com/socketstream/ss-ejs
EJS (HTML) code wrapper for SocketStream 0.3
https://github.com/socketstream/ss-ejs
Last synced: 2 months ago
JSON representation
EJS (HTML) code wrapper for SocketStream 0.3
- Host: GitHub
- URL: https://github.com/socketstream/ss-ejs
- Owner: socketstream
- Archived: true
- Created: 2013-11-13T23:25:44.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-11-17T13:32:47.000Z (about 12 years ago)
- Last Synced: 2024-12-19T17:02:08.301Z (12 months ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 2
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
SS-EJS
===
EJS (HTML) code wrapper for SocketStream 0.3
Install
---
npm install ss-ejs
Usage
---
Add this line of code to your app.js file:
ss.client.formatters.add(require('ss-ejs'));
Passing variables to your ejs view files
---
In the app.js file, pass locals to your view template like this:
ss.client.formatters.add(require('ss-ejs'), {locals: {user: 'Paul'}});
Then, in your views/app.ejs file, load the SocketStream headers like this:
<%- SocketStream %>
Welcome
And use the local variables in your ejs template like this:
Quick Chat Demo for <%= locals.user %>
TODO
---
I've noticed that how we pass local variables to our ejs template isn't flexible in terms of having multiple ejs view templates with different local variables. I will look to resolve this issue in the near future.