 (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,

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

                                           (re-pattern (str page "$")) "")
                                          (string/replace #"/*$" ""))))
                    (History.)))
        (evt/listen EventType.NAVIGATE #(when (.-isNavigation %)
                                          (dispatch [:set-page (.-token %)])))
        (.setEnabled true))
      (let [token (.getToken history)
            p (if (and page (not html5) (empty? token))
                page
                token)]
        (dispatch [:set-page p])))))

(defn to-relative [f]
