Change Log
December 11, 2021 ยท View on GitHub
v0.10.2-SNAPSHOT
v0.10.1 - 2021-12-11
Fixed
- Issue where somehow an invalid selector would be produced from munged function names, this fix ensures that there cannot be a selector with a hyphen+number, or number at the start of the selector. Will draft a new release when I've gotten to the bottom of this issue, currently unable to reproduce. See issue #7.
- Hashing issue using fractional values #9. Convert style object to string
before calculating hash
(= (hash 1) (hash 1.4)) => true
v0.10.0
Changed
- The
:keyand:groupmeta data is now completely removed, deciding instead to "automatically key" all functions based on the computed style. This results in a bit different class/id where a hash is appended to the selector. This won't break anything but it does make the API much simpler. This also has the added benefit of improving grouping performance significantly.
Added
-
Add
:hintmeta data. Can be used to extend classname in case you need some more data to attached to classname. The hint is only used during development builds, by checking thegoog.DEBUGflag. If you'd like to see the hint during advanced builds setgoog.DEBUGto true in production compiler config.(defn style [] ^{:hint "my-hint"} {:color "red"}).ns_function_my-hint_1234567 { color: red; }
v0.9.0
Breaking change
- This library from here on out only supports
cljsenvironment. Previously most of the library was written incljcto allow for easier testing, which made it possible to use Herb in regular Clojure environments. The functionality was severly limited and honestly I don't see much use for it. If you'd like to do some server side CSS rendering a much better option is simply using Garden directly.
Changed
- By using the macro sugar
trick
users no longer have to require macros via the usual methods like
:require-macros, just require in the macros like any other function fromherb.core(ns my.namespace (:require [herb.core :refer [<class defgroup]]))
v0.8.2 - 2019-07-10
Fixed
- Fixed issue in
<stylemacro wherethrowwould get the wrong number of arguments and error out.
Changed
- Markedly improve performance when using large stylegroups
- Upgrade dependencies
v0.8.1 - 2019-05-13
Changed
- Upgrade garden dependency to version 1.3.9
- Re-enable minification/pretty-printing
v0.8.0 - 2019-03-30
Changed
- Updated dependencies
Fixed
- Allow passing at-rules (at-media, at-supports ...) to defglobal
Added
- New meta type
:combinators, allows for targeting using garden selector combinators like>,+,-,descendantfromgarden.selectorsnamespace.
(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.
v0.7.2 - 2019-01-01
Changed
- Remove clojure tools.analyzer dependency
- Temporarily disable pretty printing due to a bug affecting certain media queries.
- Remove debux-stubs dependency
v0.7.1 - 2018-12-28
Changed
- Split out site as a separate project.
- Move examples to demo/examples
v0.7.0 - 2018-12-27
Breaking change
:auto-prefixin component meta is removed, instead use either global config via herb.core/init! or pass:prefix trueand:vendorsfor a local override.join-classesis renamed tojoin
Added
- New global
herb.core/init!function defined and currently takes only:vendorsand:auto-prefixas possible options - Finish first draft of the tutorial page
Changed
- Improve error handling, and use
clojure.specfor various input validation :auto-prefixnow accepts strings as well as keywords- Add passing multiple elements in
defglobalfor a single rule:(defglobal [:body :html {:margin 0}])
Fixed
- Change how the
data-herbattr is parsed, fixing issue with namespace slashes not matching fully qualified name
v0.6.0 - 2018-10-13
Breaking change
global-style!runtime function has been replaced bydefglobalmacro
Changed
- Upgrade dependencies
- The herb data string is no longer used in production builds
- Data-string now more resemble the fully qualified name of input function
- Change project structure from multiple separate projects to a single project
- Disable CSS pretty printing on production builds
Added
- @supports queries via
:supportsmetadata - @keyframes support via
defkeyframesmacro and accompanying<keyframesmacro - vendor prefixes via
:vendorsand:auto-prefixmetadata - defglobal macro that when used appends garden style vectors to head as CSS
v0.5.0 - 2018-06-17
Added
- Clojure support
<stylemacro that returns realized styles instead of a classnamedefgroupmacro to wrap common pattern
Changed
- Business logic now in
cljcto simplify testing, using lein test instead of a javascript runner - Rename
set-global-style!toglobal-style! - Rename
:modeto:pseudo
v0.4.0 - 2018-03-31
Fixed
- Issue with passing a keyword as a style key causing a crash
Added
- New meta data
:idthat returns an id instead of a classname - Add
set-global-style!helper fn that assists setting styles to global elements like , and so forth - Add
join-classeshelper fn that takes multiple class names and joins them. - Setup
:advancedbuild, using munged function names in-place of fully qualified names
Changed
- Introduce two new macros
<classand<idand deprecatewith-style - Changed identifier and data string to use input functions
.-namefield. This allows for nested forms. - Include NS in anonymous function identifiers and data string to make them easier to debug
- Args are no longer used as a data string identifier, key is used instead since it would more likley conform to a readable identifier.
v0.3.5 - 2018-02-23
Changed
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]]}
Fixed
- Fixed issue where multiple levels of extended style fns would not work.
v0.3.4 - 2018-02-19
Fixed
- Fixed issue where an extra dash got added to the returned classname
v0.3.3 - 2018-02-17
Added
- Unit tests
Changed
- Improve anonymous function classname hashing
- Passed keys now replace all non legal characters with underscore, making it more lenient.
v0.3.2 - 2018-02-15
Changed
- Refactor large portions of the codebase
Fixed
- Issue with :extend meta-data and multiple single functions with args
v0.3.1 - 2018-02-11
Added
- Anonymous functions, with-style can now take named or unnamed functions.
Anonymous functions gets the name
name.space/anonymous-(hash). Hash is calculated from the combined string of returned style map and meta.
v0.3.0 - 2018-02-11
Breaking change
Macro NS has changed so, to require macro all requires of herb need to change
from herb.macro to herb.core
Added
- Support media queries
Changed
- Move macro ns to core.clj, move rest into core.cljs
Fixed
- Fixed issues with inheritance precedence