mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 14:12:36 -05:00
Merge branch 'fix-token-reference-issue' into 199-branch-name
This commit is contained in:
commit
6da855c741
1 changed files with 9 additions and 5 deletions
|
@ -82,14 +82,18 @@
|
||||||
(and (set? errors)
|
(and (set? errors)
|
||||||
(get errors :style-dictionary/missing-reference)))
|
(get errors :style-dictionary/missing-reference)))
|
||||||
|
|
||||||
(defn tokens-name-map [tokens]
|
(defn tokens-name-tree [tokens]
|
||||||
(->> tokens
|
(reduce
|
||||||
(map (fn [[_ x]] [(:name x) x]))
|
(fn [acc [_ {:keys [name] :as token}]]
|
||||||
(into {})))
|
(if (string? name)
|
||||||
|
(let [name-path (->> (str/split name #"\.")
|
||||||
|
(remove str/blank?))]
|
||||||
|
(assoc-in acc name-path token))))
|
||||||
|
{} tokens))
|
||||||
|
|
||||||
(defn resolve-tokens+
|
(defn resolve-tokens+
|
||||||
[tokens & {:keys [debug?] :as config}]
|
[tokens & {:keys [debug?] :as config}]
|
||||||
(p/let [sd-tokens (-> (tokens-name-map tokens)
|
(p/let [sd-tokens (-> (tokens-name-tree tokens)
|
||||||
(resolve-sd-tokens+ config))]
|
(resolve-sd-tokens+ config))]
|
||||||
(let [resolved-tokens (reduce
|
(let [resolved-tokens (reduce
|
||||||
(fn [acc ^js cur]
|
(fn [acc ^js cur]
|
||||||
|
|
Loading…
Add table
Reference in a new issue