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

Support server side rendering #13

Closed
antoniandre opened this issue Sep 4, 2018 · 7 comments · Fixed by #49
Closed

Support server side rendering #13

antoniandre opened this issue Sep 4, 2018 · 7 comments · Fixed by #49

Comments

@antoniandre
Copy link
Owner

antoniandre commented Sep 4, 2018

In regards to issue #10, the request is to support server side rendering.

Please note that in Nuxt you can use Vueper Slides by wrapping your slideshow with the <no-ssr> tag. (refer to issue #6)

@antoniandre
Copy link
Owner Author

Document and window are part of DOM so it will not be compatible with SSR as long as DOM is not accessible from there.
Putting checks around those variables will not help build the slideshow from server side if DOM is not available.
I will do some tests to see if I can split what can be done from SSR and what can't and will decide if the code refactoring and code complexity increase is worth it.

I will close this issue when I have done the tests or modifications.

@AndrewBogdanovTSS
Copy link

@antoniandre could you describe what exactly is dependent on Window and Document? Do you generate your markup using document methods? If you use vue templates with directives such as v-for - it will work fine with SSR as well as using render function generative nature

@antoniandre
Copy link
Owner Author

Hi @AndrewBogdanovTSS, Thanks for your feedback and sorry for the delay I am very busy at the moment.
I haven't spent much time on Nuxt but it seemed logic to me that trying to render the slideshow without DOM is not possible.
What I need when vueperslides is mounted in DOM is: adding event listeners in document, checking if the device has a touchscreen from window and appending slide clones in document in DOM when infinite mode is on.
That's about it. If you can find a way to get it working without DOM, I am happy to modify the code.

@TheNoim
Copy link

TheNoim commented Sep 15, 2019

What I need when vueperslides is mounted in DOM is: adding event listeners in document, checking if the device has a touchscreen from window and appending slide clones in document in DOM when infinite mode is on.

This is nothing you need to do. SSR is about rendering the skeleton and not about adding the logic. By just skimming over how a slider works, you could render the basic structure and add everything other in the browser later. For a static slide you don't need the dom at all.

@AndrewBogdanovTSS
Copy link

@TheNoim is right, you just need to render DOM that is related to slides and add functionality that is dependant on window and document only once those are available, for example in mounted hook

@antoniandre
Copy link
Owner Author

Quick heads up!
SSR is now supported in Vueper Slides since version 1.20.3.
Now Vueper Slides v2 is released and tested on Nuxt 2: #55.

@AndrewBogdanovTSS
Copy link

@antoniandre should this one also be closed? #50

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

Successfully merging a pull request may close this issue.

3 participants