Liking cljdoc? Tell your friends :D

garden.def


defcssfnclj/smacro

(defcssfn sym)
(defcssfn sym & fn-tail)

Define a function for creating custom CSS functions. The generated function will automatically create an instance of garden.types.CSSFunction of which the :args field will be set to whatever the return value of the original function is. The :function field will be set to (str name).

If only the name argument is provided the returned function will accept any number of arguments.

Ex. (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) 

Ex. (defcssfn attr ([name] name) ([name type-or-unit] [[name type-or-unit]]) ([name type-or-unit fallback] [name [type-or-unit fallback]])) ;; => #'user/attr

(attr :vertical :length)
;; => #garden.types.CSSFunction{:function "url", :args [:vertical :length]}

(css (attr :vertical :length))
;; => "attr(vertical length)"

(attr :end-of-quote :string :inherit) 
;; => #garden.types.CSSFunction{:function "url", :args [:end-of-quote [:string :inherit]]}

(css (attr :end-of-quote :string :inherit))
;; => "attr(end-of-quote string, inherit)"
Define a function for creating custom CSS functions. The generated
function will automatically create an instance of
`garden.types.CSSFunction` of which the `:args` field will be set
to whatever the return value of the original function is. The
`:function` field will be set to `(str name)`.

If only the `name` argument is provided the returned function will
accept any number of arguments.

Ex.
    (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) 

Ex.
    (defcssfn attr
      ([name] name)
      ([name type-or-unit]
         [[name type-or-unit]])
      ([name type-or-unit fallback]
         [name [type-or-unit fallback]]))
    ;; => #'user/attr

    (attr :vertical :length)
    ;; => #garden.types.CSSFunction{:function "url", :args [:vertical :length]}

    (css (attr :vertical :length))
    ;; => "attr(vertical length)"

    (attr :end-of-quote :string :inherit) 
    ;; => #garden.types.CSSFunction{:function "url", :args [:end-of-quote [:string :inherit]]}

    (css (attr :end-of-quote :string :inherit))
    ;; => "attr(end-of-quote string, inherit)"
sourceraw docstring

defkeyframesclj/smacro

(defkeyframes sym & frames)

Define a CSS @keyframes animation.

Ex. (defkeyframes my-animation [:from {:background "red"}]

  [:to
   {:background "yellow"}])

(css {:vendors ["webkit"]}
  my-animation ;; Include the animation in the stylesheet.
  [:div
   ^:prefix ;; Use vendor prefixing (optional).
   {:animation [[my-animation "5s"]]}])
Define a CSS @keyframes animation.

Ex. 
    (defkeyframes my-animation
      [:from
       {:background "red"}]

      [:to
       {:background "yellow"}])

    (css {:vendors ["webkit"]}
      my-animation ;; Include the animation in the stylesheet.
      [:div
       ^:prefix ;; Use vendor prefixing (optional).
       {:animation [[my-animation "5s"]]}])
sourceraw docstring

defruleclj/smacro

(defrule sym & selectors)

Define a function for creating rules. If only the name argument is provided the rule generating function will default to using it as the primary selector.

Ex. (defrule a) ;; => #'user/a

(a {:text-decoration "none"})
;; => [:a {:text-decoration "none"}]

Ex. (defrule sub-headings :h4 :h5 :h6) ;; => #'user/sub-headings

(sub-headings {:font-weight "normal"})
;; => [:h4 :h5 :h6 {:font-weight "normal"}]
Define a function for creating rules. If only the `name` argument is
provided the rule generating function will default to using it as the
primary selector.

Ex.
    (defrule a)
    ;; => #'user/a

    (a {:text-decoration "none"})
    ;; => [:a {:text-decoration "none"}]

Ex.
    (defrule sub-headings :h4 :h5 :h6)
    ;; => #'user/sub-headings

    (sub-headings {:font-weight "normal"})
    ;; => [:h4 :h5 :h6 {:font-weight "normal"}]
sourceraw docstring

defstylesclj/smacro

(defstyles name & styles)

Convenience macro equivalent to (def name (list styles*)).

Convenience macro equivalent to `(def name (list styles*))`.
sourceraw docstring

defstylesheetclj/smacro

(defstylesheet name & styles)

Convenience macro equivalent to (def name (css opts? styles*)).

Convenience macro equivalent to `(def name (css opts? styles*))`.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close