Clojure(Script) library for styling user interface components with ease.
MIT License
::stylefy/media
and ::stylefy/supports
can now be defined using vector syntax. This is useful if the order of the rules matter in CSS.stylefy/supports
style map (manual mode and scoping were previously missing)Published by Jarzka over 3 years ago
::stylefy/scope
, which can be used to define styles that are applied only when the currentPublished by Jarzka over 3 years ago
April 9, 2021
stylefy.impl.dom
, which handles DOM manipulation when using styles in components, has been (mostly) removed and replaced with external modules. This change frees stylefy from depending on Reagent, which makes it possible to support many UI libraries / frameworks. At the beginning, three different modules are available:
stylefy/reagent
, which is essentially stylefy.impl.dom
that was shipped in previous versions.stylefy/rum
, which is functionally the same module as stylefy/reagent
, but for Rum.stylefy/generic-dom
is a general-purpose solution that does not depend on any specific UI library / framework. It makes only synchronous DOM updates, so the wide support comes with the cost of performance.stylefy/class
and clojure.core/class
is now ignored.Assuming you are using Reagent, update stylefy version and add stylefy/reagent
as a new dependency. Your dependencies should look something like this:
[stylefy "3.0.0"]
[stylefy/reagent "3.0.0"]
Require stylefy.reagent
and initialise it together with stylefy (along with any other options you pass to stylefy/init
):
(:require [stylefy.reagent :as stylefy-reagent])
(stylefy/init {:dom (stylefy-reagent/init)})
That's it!
Published by Jarzka over 3 years ago
Published by Jarzka over 4 years ago
Published by Jarzka over 4 years ago
keyframes
, font-face
, tag
, class
and prepare-styles
always return nil, as the return value was never designed to be used anywhere.Published by Jarzka over 4 years ago
Published by Jarzka over 4 years ago
keyframes
, font-face
, tag
and class
on the backend.Published by Jarzka over 4 years ago
::stylefy/with-classes
to use-style
via options map (second argument of use-style
). If you do this, a warning message is logged and the value is ignored. This feature has been marked as deprecated since version 1.3.0 (2018). If you have used ::stylefy/with-classes
in options map, you can easily replace it with :class
. Notice that passing ::stylefy/with-classes
via style map (first argument of use-style
) is still perfectly valid, this change is only related to the options map.:class
in HTML attributes and :stylefy.core/with-classes
in style map now support additional syntax: you can pass a string, a keyword or a vector of strings or keywords. You can also pass a vector of both keywords and strings if you wish. nil
is also accepted and it will be ignored. Discussion: https://github.com/Jarzka/stylefy/issues/44
use-style
on the backend, when generating Hiccup code. This new feature does not affect how you use stylefy on the frontend. If you don't need SSR, you can simply omit it by doing nothing.Published by Jarzka over 4 years ago
If you have used stylefy's auto-generated class names in tests, you can expect the values of those tests to change.
Published by Jarzka about 5 years ago
The project also got a new logo with this release.
Published by Jarzka about 5 years ago
Published by Jarzka over 5 years ago
Published by Jarzka over 5 years ago
Published by Jarzka over 5 years ago
Published by Jarzka over 5 years ago
Published by Jarzka over 5 years ago
This is ultimately the same thing as prepare-styles, but it takes only one style map as a parameter and returns it. This makes it easy to prepare a style along with use-style:
[:div (use-style (prepare-style style))]
I want to remind that just as with prepare-styles, the need for using prepare-style is rare, but when it's needed, it's now a bit easier to use if the render function needs only one or two style maps to be prepared. If there are multiple style maps that need to be prepared, it is recommended to call prepare-styles instead.
Previously DOM was updated after every single sub-style preparation. Now the update is done only after the whole style map has been prepared, and only if the style map does not already exist in the DOM.
Published by Jarzka over 5 years ago
Published by Jarzka over 5 years ago
defcssfn
. See discussion: https://github.com/Jarzka/stylefy/issues/34