Skip to content
Browse files

parameterize templates dir

  • Loading branch information...
1 parent 4c54322 commit 6ad66c9843072f8a8101658990ace5b7af9d20b2 @mmikulicic committed Mar 29, 2010
Showing with 8 additions and 1 deletion.
  1. 0 { → pages}/example.haml
  2. +2 −0 src/haml_macro.clj
  3. +6 −1 src/haml_macro/core.clj
View
0 example.haml → pages/example.haml
File renamed without changes.
View
2 src/haml_macro.clj
@@ -3,3 +3,5 @@
(defmacro haml [file]
(apply list compojure/html (haml-file file)))
+
+(defn set-templates-dir [dir] (reset! *templates-dir* dir))
View
7 src/haml_macro/core.clj
@@ -82,8 +82,13 @@
(defn haml-str [strn]
(:value (parse source strn)))
+(def *templates-dir* (atom "."))
+
(defn haml-file [file]
- (haml-str (slurp file)))
+ (haml-str (slurp (str @*templates-dir* "/" file))))
+
+(defn haml-file-name [file]
+ (str *templates-dir* "/" file))
(defn eval-haml-file [file]
(eval (apply list compojure/html (haml-file file))))

0 comments on commit 6ad66c9

Please sign in to comment.
Something went wrong with that request. Please try again.