Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git clone git://github.com/russelldb/tempile.git
git submodule update --init
cd deps/mustache.erl
mkdir ebin
erlc mustache.erl
mv mustache.bin ebin/
cd ../../
./rebar compile
erl -pa ebin/ deps/mustache.erl/ebin
application:start(tempile).
tempile:render("test", dict:from_list([{planet, "earth"}])).

or something like that.


Provide a -config myconfig.config param to the vm on startup of put all your tempates in priv/templates.

The former is better. Something like

[{tempile, [{root, "/my/webapp/priv/templates/"}, {extension, ".tache"}]}].

in a myapp.config will get all xxxx.extension compiled as mustache templates. Then use

tempile:render("templatename", contect_dict).

to render.

Tempile watches the directory you specify as root and any files added or changed are recompiled.

I am using this with [Webmachine](http://bitbucket.org/justin/webmachine/wiki/Home "webmachine") just by starting tempile and naming templates after resources.
In your resources to_html call tempile:render(?MODULE, YourContext) and add any view methods you need to the resource. Alternativly call tempile:render(your_view_module, YourContext) with
a parameterized module or the name of a view specific module of your choice.

About

compiles mustache templates and renders them too. There is now an erlydtl branch too

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages