forked from socketstream/ss-hogan
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
278 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,7 @@ node_modules | |
dump.rdb | ||
npm-debug.log | ||
*.tgz | ||
*.swp | ||
*.swo | ||
*~ | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,4 @@ | ||
0.1.3 / 2012-04-10 | ||
0.1.0 / 2012-09-20 | ||
================== | ||
|
||
* New API for SocketStream 0.3 beta2 | ||
* Now includes client code (Hogan VM) for client | ||
* Improved error reporting in console | ||
* Reset repo to remove rubbish | ||
|
||
|
||
0.1.2 / 2012-03-17 | ||
================== | ||
|
||
* Templates are now appended to `ss.tmpl` instead of global variables (e.g. `HT`) | ||
* Tip: You may put `window.HT = ss.tmpl` into `entry.js` to avoid changing your code | ||
* Reduced amount of code output for apps with many templates | ||
|
||
|
||
0.1.1 / 2012-03-17 | ||
================== | ||
|
||
* Upgraded `hogan` to 2.0.0 | ||
|
||
|
||
0.1.0 / 2012-01-14 | ||
================== | ||
|
||
* Initial commit | ||
* Initial commit | ||
* Forked from ss-hogan v0.1.3 https://github.com/socketstream/ss-hogan/commit/ab32279bfd57882bb7feeccc66faee3e39843749 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,42 @@ | ||
# Hogan Template Engine wrapper for SocketStream 0.3 | ||
# Handlebars Template Engine wrapper for SocketStream 0.3 | ||
|
||
http://twitter.github.com/hogan.js/ | ||
http://handlebarsjs.com/ | ||
|
||
Use pre-compiled Hogan (Mustache-compatible) client-side templates in your app to benefit from increased performance and a smaller client-side library download. | ||
Use pre-compiled Handlebars client-side templates in your app. | ||
|
||
|
||
### Installation | ||
|
||
The `ss-hogan` module is installed by default with new apps created by SocketStream 0.3. If you don't already have it installed, add `ss-hogan` to your application's `package.json` file and then add this line to app.js: | ||
Add ss-handlebars to your application's package.json file and then add this line to app.js: | ||
|
||
```javascript | ||
ss.client.templateEngine.use(require('ss-hogan')); | ||
ss.client.templateEngine.use(require('ss-handlebars')); | ||
``` | ||
|
||
Restart the server. From now on all templates will be pre-compiled and accessibale via the `ss.tmpl` object. | ||
|
||
Note: Hogan uses a small [client-side VM](https://raw.github.com/twitter/hogan.js/master/lib/template.js) which renders the pre-compiled templates. This file is included and automatically sent to the client. | ||
Note: Handlebars uses a small [client-side runtime](http://handlebarsjs.com/precompilation.html) which renders the pre-compiled templates. This file is included and automatically sent to the client. | ||
|
||
|
||
### Usage | ||
|
||
E.g. a template placed in | ||
|
||
/client/templates/offers/latest.html | ||
/client/templates/offers/latest.hds | ||
|
||
Can be rendered in your browser with | ||
|
||
```javascript | ||
// assumes var ss = require('socketstream') | ||
var html = ss.tmpl['offers-latest'].render({name: 'Special Offers'}) | ||
var html = ss.tmpl['offers-latest']({name: 'Special Offers'}) | ||
``` | ||
|
||
|
||
### Options | ||
|
||
When experimenting with Hogan, or converting an app from one template type to another, you may find it advantageous to use multiple template engines and confine use of Hogan to a sub-directory of `/client/templates`. | ||
When experimenting with Handlebars, or converting an app from one template type to another, you may find it advantageous to use multiple template engines and confine use of Handlebars 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-hogan'), '/hogan-templates'); | ||
``` | ||
ss.client.templateEngine.use(require('ss-handlebars'), '/hds-templates'); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.