 ;; CSS reloading
 
 (defn current-links []
-  (.call (.. js/Array -prototype -slice) (.getElementsByTagName js/document "link")))
+  (.call (.. js/Array -prototype -slice)
+         (.getElementsByTagName js/document "link")))
 
 (defn truncate-url [url]
   (-> (first (string/split url #"\?")) 

  (go
   (<! (timeout 100))
   (on-cssload (:files files-msg))))


    (or (= file trunc-href)
        (= (truncate-url request-url) trunc-href))))

(defn matches-file-new?
  [{:keys [file]} link]
  (when-let [link-href (.-href link)]
    (let [match-length (count (take-while identity
                                          (map #(= %1 %2)
                                               (reverse file)
                                               (reverse (truncate-url link-href)))))
          file-name-length (count (last (string/split file "/")))]
      (when (>= match-length file-name-length) ;; has to match more than the file name length
        {:link link
         :link-href link-href
         :match-length match-length
         :current-url-length (count (truncate-url link-href))}))))

(defn get-correct-link [f-data]
  (when-let [res (first
                  (sort-by
                   (fn [{:keys [match-length current-url-length]}]
                     (- current-url-length match-length))
                   (keep #(matches-file-new? f-data %)
                         (current-links))))]
    (:link res)))

(defn clone-link [link url]
  (let [clone (.createElement js/document "link")]
