green-coder / girouette

Grammar-based, generative approach to CSS.
MIT License
204 stars 18 forks source link

Can string/keyword harvesting be parameterized? #99

Open raystubbs opened 6 months ago

raystubbs commented 6 months ago

Any chance these can be parameterized?

; girouette.processor:88-95
(defn- string->classes [s]
  (->> (str/split s #"\s+")
       (remove str/blank?)))

(defn- kw->classes [kw]
  (->> (name kw)
       (re-seq #"\.[^\.#]+")
       (map (fn [s] (subs s 1)))))

I'd prefer to use keywords over strings for conditional classes (e.g :class (if something [:class-1 :class-2] [:class-3])). Not a deal breaker, this project is awesome! But this would make it that much more awesome, I think.

green-coder commented 6 months ago

If it doesn't break anything for the current users, a PR is welcome.

raystubbs commented 6 months ago

Sweet, I may do that when I find a second.