mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-24 02:16:56 -06:00
variable.export css: number lengths in px
A radius exported as `--radius: 12` was invalid where CSS reads it as a length (`border-radius: var(--radius)` ignores a bare number). Number values now carry px unless the layers bound to them, their scopes, or the variables aliasing them make them an opacity or a font weight, which stay bare. The roles come from a small token_roles module. Updates the variables_io_tests expectation for the radius (4 → 4px, 6.5 → 6.5px), and adds a test for a bound radius, a bound opacity and an opacity alias's target.
This commit is contained in:
+3
-1
@@ -903,7 +903,9 @@ frame back to Auto, inheriting its parent's mode).
|
||||
The same JSON carries variables between FigCraft files: `variable.export {collections?, format?,
|
||||
path?}` writes this file's collections (default: all but library copies) as a local variables
|
||||
response (`format: "json"`, the default) or as CSS custom properties (`format: "css"`: the default
|
||||
mode on `:root`, each other mode on `[data-<collection>="<mode>"]`, aliases as `var(--name)`), and
|
||||
mode on `:root`, each other mode on `[data-<collection>="<mode>"]`, aliases as `var(--name)`, numbers
|
||||
in px unless the layers bound to them, their scopes or the variables aliasing them make them an
|
||||
opacity or a font weight, so `border-radius: var(--radius)` reads `12px`), and
|
||||
returns `{text}` (or writes `path` and returns `{path}`). `variable.import {variables}` (an object,
|
||||
JSON text or a path; `variableCollections` and `variables` under `meta` or at the top level) reads
|
||||
one back: a collection joins this file's collection of the same name
|
||||
|
||||
Reference in New Issue
Block a user