Closure Template 是google release 的工具Closure Tools其中之一,我會注意到這個工具是因為前端產生動態layout的需求愈來愈多,雖然已經很盡力要將邏輯與template分開,但前端跟layout的結合實在是太密切,很難說分就分,雖然要把layout獨立出來要花更多時間,但至少會更好維護,往後要換template也不用再重寫程式,本篇文章稍微紀錄一下使用心得與過程。
if (typeof examples == 'undefined') { var examples = {}; }
{namespace examples}
/**
* Says hello to the world.
*/
{template .helloWorld}
Hello world!
{/template}
if (typeof examples == 'undefined') { var examples = {}; }
if (typeof examples.helloworld == 'undefined') { examples.helloworld = {}; }
{template .helloName}
blablabla
{/template}
java -jar SoyToJsSrcCompiler.jar --outputPathFormat simple.js simple.soy

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 