<style
macro where throw
would get the wrong number of arguments and error out.:combinators
, allows for targeting using garden selector
combinators like >
, +
, -
, descendant
from garden.selectors
namespace.(defn selector-test []
^{:combinators {[:> :div :span] {:margin-left "10px"
:background "red"}
[:+ :p] {:background "purple"
:margin 0
:margin-left "20px"}
[:- :div] {:background "yellow"}
[:descendant :div] {:background "green"}}}
{:background :blue
:color :white})
Result:
.herbdemo_examples_selector-test {
background: blue;
color: white;
}
.herbdemo_examples_selector-test > div > span {
margin-left: 10px;
background: red;
}
.herbdemo_examples_selector-test + p {
background: purple;
margin: 0;
margin-left: 20px;
}
.herbdemo_examples_selector-test ~ div {
background: yellow;
}
.herbdemo_examples_selector-test div {
background: green;
}
The syntax is a map with a vector of variable length as a key, starting with whatever combinator function you want to run as a keyword. Some combinators takes multiple elements as arguments. After that put whatever style map you'd like to be applied.
:auto-prefix
in component meta is removed, instead use either global config
via herb.core/init! or pass :prefix true
and :vendors
for a local override.join-classes
is renamed to join
herb.core/init!
function defined and currently takes only
:vendors
and :auto-prefix
as possible optionsclojure.spec
for various input validation:auto-prefix
now accepts strings as well as keywordsdefglobal
for a single rule:
(defglobal [:body :html {:margin 0}])
data-herb
attr is parsed, fixing issue with namespace slashes not matching fully qualified nameglobal-style!
runtime function has been replaced by defglobal
macro:supports
metadatadefkeyframes
macro and accompanying <keyframes
macro:vendors
and :auto-prefix
metadata<style
macro that returns realized styles instead of a classnamedefgroup
macro to wrap common patterncljc
to simplify testing, using lein test instead of a javascript runnerset-global-style!
to global-style!
:mode
to :pseudo
:id
that returns an id instead of a classnameset-global-style!
helper fn that assists setting styles to global elements like , join-classes
helper fn that takes multiple class names and joins them.:advanced
build, using munged function names in-place of fully qualified names<class
and <id
and deprecate with-style
.-name
field. This
allows for nested forms.A change in the :extend metadata syntax:
;; Passing single function
^{:extend some-style-fn}
;; Passing fn with args
^{:extend [some-style-fn some-arg]}
;; passing multiple functions
^{:extend [[style-fn1 "green" 42] [style-fn]]}
name.space/anonymous-(hash)
. Hash is
calculated from the combined string of returned style map and meta.Macro NS has changed so, to require macro all requires of herb need to change
from herb.macro
to herb.core
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close