kit
kit copied to clipboard
What is the purpose of snippets?
What are snippets? I see the reference in the source, but no documentation or examples. The snippets repository is also missing.
Think these are still in development. @yogthos can comment more
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.