mirror of
https://github.com/penpot/penpot.git
synced 2025-07-17 18:37:12 +02:00
Fix export
This commit is contained in:
parent
fdca6e4edf
commit
845de5d885
1 changed files with 8 additions and 8 deletions
|
@ -61,18 +61,18 @@
|
||||||
(defn export-tokens-file [tokens-json]
|
(defn export-tokens-file [tokens-json]
|
||||||
(let [file-name "tokens.json"
|
(let [file-name "tokens.json"
|
||||||
file-content (encode-tokens tokens-json)
|
file-content (encode-tokens tokens-json)
|
||||||
blob (wapi/create-blob (clj->js file-content) "application/json")]
|
blob (wapi/create-blob file-content "application/json")]
|
||||||
(dom/trigger-download file-name blob)))
|
(dom/trigger-download file-name blob)))
|
||||||
|
|
||||||
(defn transform-tokens-into-json-format [tokens]
|
(defn tokens->dtcg-map [tokens]
|
||||||
(let [global (reduce
|
(let [global (reduce
|
||||||
(fn [acc [_ {:keys [name value type]}]]
|
(fn [acc [_ {:keys [name value type]}]]
|
||||||
(assoc acc name {:$value value
|
(assoc acc name {"$value" value
|
||||||
:$type (str/camel type)}))
|
"$type" (str/camel type)}))
|
||||||
(sorted-map) tokens)]
|
(d/ordered-map) tokens)]
|
||||||
{:global global}))
|
{:global global}))
|
||||||
|
|
||||||
(defn download-tokens-as-json []
|
(defn download-tokens-as-json []
|
||||||
(let [all-tokens (deref refs/workspace-selected-token-set-tokens-OLD)
|
(let [tokens (deref refs/workspace-active-theme-sets-tokens)
|
||||||
transformed-tokens-json (transform-tokens-into-json-format all-tokens)]
|
dtcg-format-tokens-map (tokens->dtcg-map tokens)]
|
||||||
(export-tokens-file transformed-tokens-json)))
|
(export-tokens-file dtcg-format-tokens-map)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue