figma / code-snippet-editor-plugin

Translate component variants, properties, and more into dynamic code snippets for your design system.
https://www.figma.com/community/plugin/1311777988952403297/code-snippet-editor
MIT License
126 stars 11 forks source link

External JSON sync + demo file of hardcoded templates for node types #21

Closed jake-figma closed 5 months ago

jake-figma commented 5 months ago

Add a new JSON schema / type like:

type TemplatesByNodeType = { [k in BaseNode["type"]]?: CodegenResult[] }

For folks to hang templates on in the codebase itself and have that be the fallback.

This wouldn't work in the official plugin, but would be useful for folks who clone this and want to add templates for things like Typography and Layout components.

jake-figma commented 5 months ago

Also worth considering hosting the templates externally on an oauth'd account (eg. #22), or even more simply in an externally hosted/public JSON endpoint.

jake-figma commented 5 months ago

first cut playing around with this global templates concept. instead of being hardcoded (templates.ts) this would be loaded from a JSON endpoint. #14412db

jake-figma commented 5 months ago

First draft of this is in with #30

Closing for now, but open to discussion on improvements here (especially loading via JSON). Documentation for Global Templates can be found in the README