ring.velocity:render velocity templates for ring in clojure -凯发k8网页登录

生活、程序、未来
   :: 凯发k8网页登录首页 ::  ::  :: 聚合  :: 管理
home: 

a clojure library designed to render velocity template for ring in clojure.

usage

adds dependency in leiningen project.clj:

  [ring.velocity "0.1.0-snapshot"] 

create a directory named templates in your project directory to keep all velocity templates.

create a template templates/test.vm:

  hello,$name,your age is $age. 

use ring.velocity in your namespace:

  (use '[ring.velocity.core :only [render]]) 

use render function to render template with vars:

  (render "test.vm" :name "dennis" :age 29) 

the test.vm will be interpreted equals to:

  hello,dennis,your age is 29. 

use ring.velocity in :

  (defroutes app-routes      
(get "/" [] (render "test.vm" :name "dennis" :age 29))
(route/not-found "not found"))

use ring.velocity in :

  (use '[ring.util.response])   
(response (render "test.vm" :name "dennis" :age 29))

custom velocity properties,just put a file named ring-velocity.properties to your classpath or resource paths.the default velocity properties is in .

license

凯发天生赢家一触即发官网 copyright © 2012 dennis zhuang[killme2008@gmail.com]

distributed under the eclipse public license, the same as clojure.

home: 

网站地图