 
 (defonce history nil)
 
+(defn as-relative [f]
+  (clojure.string/replace f #"^/" ""))
+
 (defn demo-handler [state [id v1 v2 :as event]]
   (case id
     :content (do

    state))

(defn dispatch [event]
  ;; (dbg event)
  (rswap! config demo-handler event)
  nil)


  (log "Generating site")
  (swap! config merge (js->clj opts :keywordize-keys true))
  (let [dir (:site-dir @config)
        timestamp (str "?" js/Date.now)]
    (doseq [f (:pages @config)]
      (write-file (path-join dir (dbg (as-relative f)))
                  (gen-page f timestamp)))
