     ;; (pp/pprint merged-maps)
     merged-maps))
 
+(defn- typify
+  [config-maps]
+  (for [cfg config-maps]
+    (do (println "TYPIFY: " cfg)
+        (merge cfg
+               {:config (for [config (:config cfg)]
+                          (merge config
+                                 (if (str/ends-with? (:uri config) ".js")
+                                   {:js true})
+                                 (if (str/ends-with? (:uri config) ".css")
+                                   {:css true})))}))))
+
 (boot/deftask config
-  [c nss NSS #{sym} "config namespaced sym"
+  [c config-syms CONFIG-SYMS #{sym} "config namespaced sym"
    b base PATH str "bower components base path, default: bower_components"
    o outdir PATH str "install dir, default: classes"]
-  (let [nss   (if nss nss #_(if (namespace nss)
-                              nss (throw (Exception. (str "config symbol must be namespaced"))))
+  (let [config-syms   (if config-syms config-syms #_(if (namespace config-syms)
+                              config-syms (throw (Exception. (str "config symbol must be namespaced"))))
                   #{'bower/config})
         base (if base base "bower_components")
         outdir   (if (nil? outdir) "classes" outdir)


(defn- normalize-configs
  [base configs]
  ;; (println "normalize-configs: " configs)
  (let [resources (filter #(symbol? (first %)) configs)
        ;; _ (println "RESOURCES: " resources)
        normresources (into [] (for [resource resources]
                                 (do ;; (println "RESOURCE: " resource)
                                 (merge (last resource)
                                        (if (str/ends-with? (:uri (last resource)) ".js")
                                          {:js true})
                                        (if (str/ends-with? (:uri (last resource)) ".css")
                                          {:css true})
                                        {:ns (namespace (first resource))
                                         :name (name (first resource))}))))
        ;; _ (println "NORMRESOURCES: " normresources)
        simples (filter #(and (not (symbol? (first %)))
                              (or (symbol? (last %)) (map? (last %)))) configs)
        normsimples (for [[k v] simples]
               (merge {:bower-pkg k}
                      (condp apply [v] symbol? {:ns (symbol (namespace v)) :name (symbol (name v))}
                             map?    v)))
        ;; _ (println "NORMSIMPLES: " normsimples)
        compounds (filter #(vector? (last %)) configs)
        ;; _ (println "COMPOUNDS: " compounds)
        normcomp (flatten (into [] (for [[pkg cfgs] compounds]
                                     (into [] (for [cfg cfgs]
                                                (do ;;(println "CFG: " cfg)
                                                (merge
                                                 (if (str/ends-with? (:uri cfg) ".js")
                                                   {:js true})
                                                 (if (str/ends-with? (:uri cfg) ".css")
                                                   {:css true})
                                                 {:bower-pkg pkg} cfg)))))))
        normed (concat normcomp normsimples normresources)
        ]
    normed))

(defn- get-config-maps
  "convert config map to data map suitable for stencil"
  [bower-base configs]
  ;; (println "get-config-maps")
  (let [nss (set (flatten (for [[k v] configs]
                            (if (string? k)
                              (cond
                                (symbol? v) (let [ns (namespace v)]
                                              (if ns (symbol ns)
                                                  (throw (Exception. "var must be namespaced"))))
                                (map? v) (:ns v)
                                (vector? v)
                                (into [] (for [item v] (:ns item)))
                                ;;FIXME: better error msg
                                :else (throw (Exception. "config val must be map or vector of maps")))
                              (if (symbol? k)
                                (namespace k)
                                (throw (Exception. "config entries must be {sym {:uri str}} or {str config}")
                              ))))))
        ;; _ (println "nss: " nss)
        normal-configs (normalize-configs bower-base configs)
        ;; _ (println "NORMAL-CONFIGS:")
        ;; _ (pp/pprint normal-configs)
        ;;now add missing uris
        config-map (into [] (for [ns-config normal-configs]
                              (if (-> ns-config :uri)
                                ns-config
                                (let [m (bower-meta (:bower-pkg ns-config))
                                      kw (keyword (-> m :latest :name))
                                      ;; _ (println "kw: " kw)
                                      poly (str/starts-with? (:bower-pkg ns-config) "Polymer")
                                      ;;_ (println "poly: " poly)
                                      uris (bower->uris bower-base m)]
                                  (merge ns-config (if (> (count uris) 1)
                                                     (throw (Exception.
                                                             (str "too many uris for bower pkg '"
                                                             (:bower-pkg ns-config)
                                                             "'; run bower info -j on the package and create a config for each latest.main entry")))
                                                     (merge
                                                      (if (str/ends-with? (first uris) ".js")
                                                        {:js true})
                                                      (if (str/ends-with? (first uris) ".css")
                                                        {:css true})
                                                      (if poly {:polymer {:kw kw}})
                                                      {:uri (first uris)})))))))]
    config-map))

(defn- ns->filestr

      (let [config-maps
            (into []
                  (flatten
                   (for [config-sym config-syms]
                        (let [config-ns (symbol (namespace config-sym))]
                          (println "CONFIG-NS: " config-ns)
                          (require config-ns)
                          ;; (doseq [[ivar isym] (ns-interns config-ns)] (println "interned: " ivar isym))
                          (if (not (find-ns config-ns)) (throw (Exception. (str "can't find config ns"))))
