mirror of
https://github.com/penpot/penpot.git
synced 2025-07-25 20:57:23 +02:00
✨ Plugins support for code generation
This commit is contained in:
parent
8ff0015458
commit
f86156b619
4 changed files with 61 additions and 10 deletions
|
@ -19,8 +19,10 @@
|
|||
(generate-markup objects shapes)))
|
||||
|
||||
(defn generate-style-code
|
||||
[objects type root-shapes all-shapes]
|
||||
(let [generate-style
|
||||
(case type
|
||||
"css" css/generate-style)]
|
||||
(generate-style objects root-shapes all-shapes)))
|
||||
([objects type root-shapes all-shapes]
|
||||
(generate-style-code objects type root-shapes all-shapes nil))
|
||||
([objects type root-shapes all-shapes options]
|
||||
(let [generate-style
|
||||
(case type
|
||||
"css" css/generate-style)]
|
||||
(generate-style objects root-shapes all-shapes options))))
|
||||
|
|
|
@ -300,10 +300,10 @@ body {
|
|||
(defn generate-style
|
||||
([objects root-shapes all-shapes]
|
||||
(generate-style objects root-shapes all-shapes nil))
|
||||
([objects root-shapes all-shapes options]
|
||||
([objects root-shapes all-shapes {:keys [with-prelude?] :or {with-prelude? true} :as options}]
|
||||
(let [options (assoc options :root-shapes (into #{} (map :id) root-shapes))]
|
||||
(dm/str
|
||||
prelude
|
||||
(if with-prelude? prelude "")
|
||||
(->> all-shapes
|
||||
(keep #(get-shape-css-selector % objects options))
|
||||
(str/join "\n\n"))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue