package ppx_css
A ppx that takes in css strings and produces a module for accessing the unique names defined within
Install
Dune Dependency
Authors
Maintainers
Sources
v0.17.0.tar.gz
sha256=e60e31aadd820b131f7f05827f369164564400bd4fd51c199d066abf7e68753f
doc/ppx_css.inline_css/Inline_css/Private/Dynamic/index.html
Module Private.Dynamic
Source
This library allows for "dynamic" use of the CSS Constructed Stylesheet API. It is more powerful than inline_css
, but can be much less performant.
Tl;dr: you should try as hard as possible for the input to attr
to be a constant, not a string Value.t
.
inline_css
registers the provided string as a constructed stylesheet as a side effect. It will never change or remove the string.
In contrast, this library's produces a Vdom.Attr.t
, which will also remove the stylesheet when it is removed from the DOM, and will update the stylesheet whenever the provided string changes, e.g. if the attr is produced by a Bonsai Value.t
. Every such update will trigger a browser style recomputation, which can be very expensive if many DOM elements are affected.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>