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

Code-Sharing support #97

Closed
ghost opened this issue Nov 12, 2019 · 2 comments
Closed

Code-Sharing support #97

ghost opened this issue Nov 12, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Nov 12, 2019

Could be great if svelte-native support Code-Sharing like vue/angular https://nativescript-vue.org/en/docs/getting-started/code-sharing/

@halfnelson
Copy link
Owner

Thanks for the suggestion. I did look into this in the past, and don't feel comfortable opting into this, at least in its current form. The styles will always be different, the templates different, the callback arguments from events different leaving the only thing shared being the script tag. Svelte components tend to have a small script tag and most common logic is extracted into stores, or plain JS.

I feel that forcing a 1 for 1 component mapping between native and web could lead to compromises in application layout/design.

That being said, Svelte does has a pre-processor option which could be used to do this and remove the style and unwanted template based on target, so I will leave this to a preprocessor and not bake it into core.

@ghost
Copy link
Author

ghost commented Nov 17, 2019

actually, the main idea of share components is to shared basic view/presentation componentes, so the HTML/CSS and some basic JS, but yeah, I think the preprocessor can do it this like sveltejs/svelte#65 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant