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

Vue renderer #1220

Open
trusktr opened this issue Aug 30, 2017 · 6 comments
Open

Vue renderer #1220

trusktr opened this issue Aug 30, 2017 · 6 comments

Comments

@trusktr
Copy link
Contributor

trusktr commented Aug 30, 2017

I wonder what a rendererCallback for using Vue inside SkateJS might look like. In particular, I'm wondering if there's some way of using Vue build-system type stuff (f.e. stuff like vue-loader for Webpack) so that we can write SkateJS components while taking advantage of that cool Vue build stuff.

Maybe it'd be a matter of simply compiling one Vue component per SkateJS component, then in the SkateJS component just refer to the compiled Vue component by name.

I'm curious to find a good way to create Custom Elements (because their API contract allows them to be used in any other framework) while still benefitting from the patterns from something like Vue.

I'll post back when/if I get to try it out.

@trusktr trusktr changed the title rendereCallback for using Vue. rendererCallback for Vue Aug 30, 2017
@treshugart
Copy link
Member

A renderer built with the 5.x renderer API would look something like: https://gist.github.com/treshugart/b27bf304a5cba2f79b5eafa5436c414e. It's not using any build system stuff, but not sure how that would look.

@trusktr
Copy link
Contributor Author

trusktr commented Aug 31, 2017

Ah cool, good for me to study, thanks!

// Since vue doesn't have an imperative re-render
// (at least I don't think it does)

It does! You cans define a render method and return something very similar to React, using Vue's createElement. This is what Vue templates use in their compiled form: https://vuejs.org/v2/guide/render-function.html

@treshugart
Copy link
Member

Yeah I saw that. I created #1221 so that we can pass through the createElement function. I find it odd, though, that they make you pass it through as an argument as opposed to exposing it as an import.

@trusktr
Copy link
Contributor Author

trusktr commented Aug 31, 2017

I believe it may be so that Vue can control the version of createElement at runtime, to avoid version mismatch problems like with React (importing createElement from one version of React then using it in a component which is in turn used in a component made with another version of React causes everything to break with strange errors in console)

@trusktr
Copy link
Contributor Author

trusktr commented Aug 31, 2017

which is in turn*

@treshugart
Copy link
Member

True. Also means you can compile JSX to a single pragma in a single file and use several different vdom functions quite easily.

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

2 participants