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

Can Svelte provide the ability to plug-and-play renderers? #5496

Closed
mrsauravsahu opened this issue Oct 4, 2020 · 8 comments
Closed

Can Svelte provide the ability to plug-and-play renderers? #5496

mrsauravsahu opened this issue Oct 4, 2020 · 8 comments

Comments

@mrsauravsahu
Copy link
Contributor

mrsauravsahu commented Oct 4, 2020

I'm currently trying to use Svelte to create applications for targets other than web. My specific use-case it that I want to use Svelte to create native applications - with libraries like Nodegui. Looking at the current implementation of the compiler, the option locks it down to use either the dom or ssr renderer. opening it up would mean allowing for custom renderers.

Is your feature request related to a problem? Please describe.
Svelte's rendering system is locked. It allows for rendering to dom and SSR. Can the compiler somehow be extracted to allow for custom renderers? This would mean custom SvelteComponent generators as the output might not be for web, as well #4168

Describe the solution you'd like
Create base classes for renderer class so that custom implementations can be passed. This allows for projects like Svelte Native and Nodegui to pass in their renderers and use the compiler.

Describe alternatives you've considered
Still at the thinking phase so open to ideas.

How important is this feature to you?
This would allow Svelte to be used in many other sorts of application than just the web. So I'd say pretty important.

Additional context
Here's the changes I'm working on currently: https://github.com/mrsauravsahu/svelte/compare/master...mrsauravsahu:feat/inject-render-function?expand=1

@mrsauravsahu
Copy link
Contributor Author

Describe the solution you'd like

Played around with the code a little bit. Currently, looks like if the compiler allowed to take the renderer itself as a parameter, svelte's compiler would get separated from the renderer. This means anyone who calls svelte - currently rollup-plugin-svelte and svelte-loader would pass renderers when compiling svelte code.
For dom and ssr generation, these would be svelte's internal renderers. But for all intents and purposes, these would be the plugin's job to pass the renderer

@DrSensor
Copy link

DrSensor commented Oct 8, 2020

Probably worth to check on svelte-native-preprocessor.
I wonder if there is already a doc on how to build a custom renderer. It would be interesting writing a svelte version reactpixi.

@mrsauravsahu
Copy link
Contributor Author

@DrSensor Yes, so I'm also thinking of writing a preprocessor. The one thing I'm trying to wrap my head around is once the renderer does its job, in the code-generation step, I need to generate custom code rather than svelte's default DOM related code, that would require extra changes.

@stale
Copy link

stale bot commented Jun 26, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale-bot label Jun 26, 2021
@stale stale bot removed the stale-bot label Jun 26, 2021
@stale stale bot removed the stale-bot label Jun 27, 2021
@dummdidumm
Copy link
Member

Duplicate of #5496

@dummdidumm dummdidumm marked this as a duplicate of #5496 Jul 11, 2021
@pngwn
Copy link
Member

pngwn commented Jul 11, 2021

This is #5496.

@pngwn pngwn reopened this Jul 11, 2021
@dummdidumm
Copy link
Member

Oh I'm sorry, I meant duplicate of #1678

@pngwn
Copy link
Member

pngwn commented Jul 11, 2021

ahaa

@pngwn pngwn closed this as completed Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants