Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the purpose of snippets? #61

Open
markokocic opened this issue Aug 10, 2022 · 2 comments
Open

What is the purpose of snippets? #61

markokocic opened this issue Aug 10, 2022 · 2 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@markokocic
Copy link
Member

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

@markokocic markokocic added documentation Improvements or additions to documentation question Further information is requested and removed question Further information is requested labels Aug 10, 2022
@nikolap
Copy link
Member

nikolap commented Aug 15, 2022

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

@yogthos
Copy link
Collaborator

yogthos commented Sep 12, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants