Fork me on GitHub
#css
<
2017-10-02
>
wilkerlucio10:10:00

@noprompt is there a way to create css @keyframes with garden?

wilkerlucio13:10:16

found the answer 🙂 garden.stylesheet/at-keyframes

noprompt17:10:38

@wilkerlucio this is something that needs to be in the README and i apologize for it not being there.

noprompt17:10:39

(require '[garden.def :refer [defrule defkeyframes]])

(defkeyframes pulse
  [:from
   {:opacity 0}]

  [:to
   {:opacity 1}])

(css {:vendors ["webkit"]
      :output-to "foo.css"}

  ;; Include our keyframes
  pulse

  [:h1
   ;; Notice we don't need to quote pulse.
   ^:prefix {:animation [[pulse "2s" :infinite :alternate]]}])

noprompt17:10:09

@keyframes pulse {

  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }

}

@-webkit-keyframes pulse {

  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }

}

h1 {
  -webkit-animation: pulse 2s infinite alternate;
  animation: pulse 2s infinite alternate;
}

wilkerlucio17:10:43

thanks, I found it on a changelog, garden is really awesome 🙂

wilkerlucio17:10:29

I like the inline version better, I'm using with Fulcro, so I can make localized animations per component, the combo of Fulcro + Garden for CSS is the best way to handle css for react components that I found so far