 (ns sitetools.core
   (:require [clojure.string :as string]
             [goog.events :as evt]
-            [goog.history.EventType :as hevt]
             [reagent.core :as r]
             [reagent.debug :refer-macros [dbg log dev?]]
             [reagent.interop :as i :refer-macros [.' .!]])
   (:import goog.History
-           goog.history.Html5History))
-
-(when (exists? js/console)
-  (enable-console-print!))
+           [goog.history Html5History EventType]))
+
+(enable-console-print!)
 
 (defn rswap! [a f & args]
   ;; Like swap!, except that recursive swaps on the same atom are ok,

   child])

(defn main-content []
  (let [comp (get-in @config [:current-page :content])]
    (assert (vector? comp))
    comp))


;;; Static site generation

(defn prefix [href page]
  (let [depth (-> #"/" (re-seq (to-relative page)) count)]
    (str (->> "../" (repeat depth) (apply str)) href)))

(defn danger [t s]
  [t {:dangerouslySetInnerHTML {:__html s}}])

  (case id
    :set-content (let [page x
                       title (:title page)
                       title (if title
                               (str (:title-prefix state) title)
                               (str (:default-title state)))]
                   (when r/is-client
                     (set! js/document.title title))
                   (assoc state :current-page page :title title))
    :set-page (let [path x
                    _ (assert (string? path))
                    ps (:pages state)
