kit icon indicating copy to clipboard operation
kit copied to clipboard

What is the purpose of snippets?

Open markokocic opened this issue 2 years ago • 2 comments

What are snippets? I see the reference in the source, but no documentation or examples. The snippets repository is also missing.

markokocic avatar Aug 10 '22 11:08 markokocic

Think these are still in development. @yogthos can comment more

nikolap avatar Aug 15 '22 09:08 nikolap

So, the idea behind snippets is to create templates that can be used to generate code in the REPL. An example snippet can be found here. The example snippet creates a Reitit route and handles all the boilerplate for it. Ideally this could works as sort of a curated Stack Overflow in the REPL. You could search for a snippet by tags or description, and then run the snippet to generate the code you need.

The snippet is a Markdown file that has to have the structure seen in the example where it declares tags, description, and a snippet. The arguments to the snippet get passed in when the snippet is called and injected in the template that's then rendered.

I was thinking of managing snippets in a similar way to modules where they could live in a repo and then new snippets can be added via pull requests.

yogthos avatar Sep 12 '22 13:09 yogthos