 
 (def prev-theme "")
 
+(defn load-theme [theme]
+  (let [themes (object/raise-reduce app/app :themes+ {})
+        path (get themes theme (plugins/adjust-path "core/css/themes/default.css"))]
+    (let [elem (load/css path)]
+      (dom-attr elem {:id (str "theme-" theme)})
+      elem)))
+
+(defn inject-theme [name]
+  (when-not (empty? prev-theme)
+    (dom/remove-class (dom/$ :#multi) prev-theme))
+  (set! prev-theme (str "theme-" name))
+  (dom/add-class (dom/$ :#multi) (str "theme-" name))
+  (when-not (dom/$ (str "#theme-" name))
+    (dom/append (dom/$ :head) (load-theme name))))
+
 (defn get-themes []
   (sort-by #(.-text %)
            (for [[theme path] (object/raise-reduce app/app :themes+ {})]
               #js {:text (pr-str theme) :completion (pr-str theme)})))
 
-(defui stylesheet [name]
-  [:link {:rel "stylesheet"
-          :type "text/css"
-          :id (str "theme-" name)
-          :href (-> (object/raise-reduce app/app :themes+ {})
-                    (get name "/core/css/themes/default.css")
-                    (plugins/adjust-path))}])
 
-(defn load-theme [name]
-  (when-not (empty? prev-theme)
-    (dom/remove-class (dom/$ :#multi) prev-theme))
-  (set! prev-theme (str "theme-" name))
-  (dom/add-class (dom/$ :#multi) (str "theme-" name))
-  (when-not (dom/$ (str "#theme-" name))
-    (dom/append (dom/$ :head) (stylesheet name))))
 
 (behavior ::provide-theme
                   :desc "Style: Provide editor theme"

                            :items get-skins}]
                  :type :user
                  :reaction (fn [this skin]
                              (when (:skin @styles)
                                (dom/remove-class (dom/$ :body) (str "skin-" (:skin @styles))))
                              (dom/add-class (dom/$ :body) (str "skin-" skin))
                              (object/merge! styles {:skin skin})))

;;**********************************************************
;; themes

            [lt.objs.deploy :as deploy]
            [lt.util.dom :as dom]
            [lt.util.load :as load]
            [crate.binding :refer [bound -value subatom]]
            [crate.compiler :refer [dom-attr]])
  (:require-macros [lt.macros :refer [behavior defui]]))

(defn css-expr [k v]
