Hi,all

    Apache velocity <http://velocity.apache.org/>is a great java template
engine used widely. I want to use it in clojure with compojure and ring
framework,so i've created this project---ring.velocity.

Home: https://github.com/killme2008/ring.velocity
Getting started:

  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" 29)

The test.vm will be interpreted equals to:

  hello,dennis,your age is 29.

Use ring.velocity in compojure:

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

Use ring.velocity in ring:

  (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
src/default/velocity.properties<https://github.com/killme2008/ring.velocity/blob/master/src/default/velocity.properties>
.

-- 
庄晓丹
Email:        killme2...@gmail.com xzhu...@avos.com
Site:           http://fnil.net
Twitter:      @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to