Skip to content

Instantly share code, notes, and snippets.

@ibdknox
Created November 27, 2011 18:16
Show Gist options
  • Save ibdknox/1397925 to your computer and use it in GitHub Desktop.
Save ibdknox/1397925 to your computer and use it in GitHub Desktop.
example of specialized defpage
(defmacro mainpage [route params & body]
`(defpage ~route ~params
(common/main-layout
~@body)))
;;Or if you wanted to get really crazy, so that you don't have to duplicate that macro
;;you could write a macro that writes the macros for you:
(defmacro layout-page [name layout]
`(defmacro ~name [route# params# & body#]
(concat `(defpage ~route# ~params#)
[(conj `(~@body#)
~layout)])))
(layout-page adminpage common/admin-layout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment