garden icon indicating copy to clipboard operation
garden copied to clipboard

defcssfn don't behave as documented

Open wolfgangshilei opened this issue 6 years ago • 2 comments
trafficstars

Environment: [garden "1.3.6"] [org.clojure/clojure "1.8.0"] [org.clojure/clojurescript "1.10.238"]

Problem: garden.def/defcssfn does not function as documented.

Details: Expected results (as documented):

(defcssfn url)
;; => #'user/url

(url "http://fonts.googleapis.com/css?family=Lato")
;; => #garden.types.CSSFunction{:function "url", :args "http://fonts.googleapis.com/css?family=Lato"}

(css (url "http://fonts.googleapis.com/css?family=Lato"))
;; => url(http://fonts.googleapis.com/css?family=Lato)

Actual results:

(defcssfn url)
;; => #'user/url

(url "http://fonts.googleapis.com/css?family=Lato")
;; => {:f "url", :args ("http://fonts.googleapis.com/css?family=Lato")}

(css (url "http://fonts.googleapis.com/css?family=Lato"))
;; => ""

Could you please help explain this discrepancy?

Thank you.

wolfgangshilei avatar Feb 03 '19 10:02 wolfgangshilei

The documentation is just wrong. It looks like CSSFunction is only rendered with css when it's in a rule. I think at one point that did work but — and it's been so long now I can't remember — a change must have caused that to stop working (though I have no idea now what that change was). I think the example call to css could probably be discarded.

noprompt avatar Feb 04 '19 22:02 noprompt

Thank you for the clarification.

wolfgangshilei avatar Feb 05 '19 13:02 wolfgangshilei