malgorithms / toffee

a NodeJS and browser templating language based on coffeescript, with the slickest syntax ever
MIT License
174 stars 10 forks source link

Document the use of toffee in the browser #3

Closed pwnall closed 12 years ago

pwnall commented 12 years ago

I liked the philosophy behind toffee, and wanted to use it for a project. I was encouraged by the project's README.md, which says "it works in the browser, too!".

Sadly, after looking around for a bit, I haven't figured out how to use it in a browser application. Can you please add this to the documentation, in the installation & usage section?

I'm hoping I can download (or build) a JS file that I can pull into my app, and it'll give me some sort of render method.

Thanks so much!

malgorithms commented 12 years ago

Hey pwnall - thanks for nudging me on this. I'll add some documentation on it this morning. There's a command-line program "toffee", which you get when you install toffee via npm. That compiles your templates into a js file you can include. Then you'll have a render method, where you name a template and the vars you'd like to pub, and it replies with a string. It also has partials/include support, which I'll explain.

-cc

malgorithms commented 12 years ago

hey @pwnall, I added a link in the Readme.md file to this wiki page, which I just wrote:

Browser Usage

Also, I just improved error printing when compiling from the command line, so make sure you have the latest toffee installed (0.0.38 or higher). just npm install it again to get the latest.

Btw, you're the first one reporting use of this in the command line, so let me know if you hit any snags. I'll act pretty fast. Question: are you using your templates server-side, too? Or just in the browser?