 (ns kioo.core
   (:refer-clojure :exclude [compile])
-  (:require [kioo.util :refer [convert-attrs flatten-nodes]]
-            [net.cgrand.enlive-html :refer [at html-resource select
-                                            any-node]]
-            [clojure.string :as string]
-            [kioo.html-parser :as parser]
-            [hickory.core :as hickory]))
+  (:require
+   [kioo.util :refer [convert-attrs flatten-nodes]]
+   [net.cgrand.enlive-html :refer [at html-resource select
+                                   any-node]]
+   [clojure.string :as string]
+   [kioo.html-parser :as parser]
+   [hickory.core :as hickory]
+   [clojure.java.io :as io]))
 
 (declare compile component*)
 

  ([path trans emit-opts]
     (component* path [:body :> any-node] trans emit-opts))
  ([path sel trans emit-opts]
     (let [resource-fn (resolve-resource-fn path emit-opts)
           root (parse-html path resource-fn)
            start (if (= :root sel)
                    root
                    (select root (eval-selector sel)))
           child-sym (gensym "ch")]

   (symbol? wrapper) (resolve wrapper)
   :else parser/->MiniHtml))


(defn path-exists? [path]
  (or (not (string? path))
      (io/resource path)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Main Structure of Compiler
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
