-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
32 lines (22 loc) · 1.19 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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.