Everything related to CSS functions.
Everything related to CSS functions.
(commajoin {:keys [compiles-to args]})
A CSSFunction util/str-commajoin compile function. Compiles the function to a form <fn-name>(arg1, arg2, arg3, ...),
A CSSFunction util/str-commajoin compile function. Compiles the function to a form <fn-name>(arg1, arg2, arg3, ...),
(css-format-fn {:keys [args] :as cssfn})
A special function for css-format which also puts additional quotes around the parameter to enable usage of keywords.
A special function for css-format which also puts additional quotes around the parameter to enable usage of keywords.
(defcssfn fn-name)
(defcssfn fn-name css-fn-or-fn-tail)
(defcssfn clojure-fn-name compiles-to compile-fn)
Defines a CSS function. In most cases, you do NOT need to define a special compile-fn function - it should always be enough to use one of single-arg, spacejoin, commajoin. All of them compile the params, but: Single-arg gives you a warning if you give it more than 1 argument and compiles the args like commajoin. Commajoin compiles all its args and str/joins them with a comma. Spacejoin compiles all its args and str/joins them with a space. All these function also take the compiles-to argument and put it in front of a bracket enclosing the str/joined arguments. You can give this function 1, 2 or 3 arguments:
(defcssfn translate) (the default compile-fn is commajoin) (translate (u/px 80) (u/css-rem 6)) ... compiles to "translate(80px, 6rem)"
(defcssfn css-min "min") (css-min (u/px 500) (u/vw 40) (u/cm 20)) ... compiles to "min(500px, 40vw, 20cm)"
(defcssfn calc spacejoin) (calc (u/px 200) add 3 mul (u/percent 20)) ... compiles to "calc(200px + 3 * 20%)"
The arity(3) can be used like this to combine both previous features of the arity(2): (defcssfn my-clj-fn "css-fn" spacejoin) (my-clj-fn (u/s 20) (u/ms 500)) ... compiles to "css-fn(20s 500ms)"
Defines a CSS function. In most cases, you do NOT need to define a special compile-fn function - it should always be enough to use one of single-arg, spacejoin, commajoin. All of them compile the params, but: Single-arg gives you a warning if you give it more than 1 argument and compiles the args like commajoin. Commajoin compiles all its args and str/joins them with a comma. Spacejoin compiles all its args and str/joins them with a space. All these function also take the compiles-to argument and put it in front of a bracket enclosing the str/joined arguments. You can give this function 1, 2 or 3 arguments: (defcssfn translate) (the default compile-fn is commajoin) (translate (u/px 80) (u/css-rem 6)) ... compiles to "translate(80px, 6rem)" (defcssfn css-min "min") (css-min (u/px 500) (u/vw 40) (u/cm 20)) ... compiles to "min(500px, 40vw, 20cm)" (defcssfn calc spacejoin) (calc (u/px 200) add 3 mul (u/percent 20)) ... compiles to "calc(200px + 3 * 20%)" The arity(3) can be used like this to combine both previous features of the arity(2): (defcssfn my-clj-fn "css-fn" spacejoin) (my-clj-fn (u/s 20) (u/ms 500)) ... compiles to "css-fn(20s 500ms)"
(single-arg {:keys [compiles-to args] :as cssfn})
A CSSFunction compile function. Presumes that only one arg is given. If not, calls commajoin function above and gives us a warning instead.
A CSSFunction compile function. Presumes that only one arg is given. If not, calls commajoin function above and gives us a warning instead.
(spacejoin {:keys [compiles-to args]})
A CSSFunction util/str-spacejoin compile function. Compiles the function to a form <fn-name>(arg1 arg2 arg3 ...),
A CSSFunction util/str-spacejoin compile function. Compiles the function to a form <fn-name>(arg1 arg2 arg3 ...),
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close