-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support for file generation #25
Comments
This is a great idea! If the end-developer provides a |
Brilliant I'll get a PR together in due course. Thanks @sgrove. Is there any chance I can ask for a "new file" svg, equivalent to the copy icon? |
What are your thoughts on an input for a filename? |
Yeah, I'll get an svg icon for you. I suspect that the snippets should probably return an array of objects:
They should render the files in the same view, but exporting should give the caller the chance to write multiple files all at once. This is helpful for setting up e.g. |
That's an interesting approach. In my use case, I have several distinct snippets that the user can choose and exporting only needs to create a single file. However the name is variable, so I can't just go with |
Even for usage in Gatsby, having ability to generate multiple snippets might be valuable: In the case of snippet that we skipped for initial integration ( in gatsbyjs/gatsby#17120 ), we were generating single snippet for Dialing back talk about gatsby usage - I'm wondering if instead of trying to add this new button in |
That's a pretty decent approach. If it wasn't obvious already, I was trying to lay the groundwork here for Gatsby 😄 , perhaps supporting an array would be useful in this library even if initial, simple consumer implementations don't support multi-generation.
I'm interested to see how that would play out. Sometimes being overly generic can lead to a clunky UI. My best suggestion at the moment is to:
|
That's good to hear, @sgrove how do you feel about this solution? If you're happy, I can start putting a PR together and we can have a conversation over it |
Yeah, I think making the header panel controls configurable for a snippet makes sense! |
Currently this library supports generating snippets which can be copy/pasted. It would be good to open up the "methods" of code exporting to allow things like exporting straight to file.
I would like to introduce an additional opt-in button that when clicked would allow a function passed via a prop to be called. A consuming library can therefore implement this however they please (writing the file to disk, etc), but benefits by allowing this library to render the snippets as usual.
What do you think to this?
The text was updated successfully, but these errors were encountered: