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

Render an initial asset during SSR #21

Closed
weotch opened this issue Jun 27, 2019 · 3 comments
Closed

Render an initial asset during SSR #21

weotch opened this issue Jun 27, 2019 · 3 comments

Comments

@weotch
Copy link
Member

weotch commented Jun 27, 2019

Currently, when vue-visual gets SSRed via Nuxt, there is no asset rendered. It would be nice if the rendering of the initial asset during SSG didn't depend in Nuxt hydrating the JS. This would also make it work better with lazy-hyrdate.

@weotch weotch changed the title Render an initial asset during SSG Render an initial asset during SSR Jun 27, 2019
@weotch
Copy link
Member Author

weotch commented Jun 27, 2019

At least in 0.4.1, even if load=true, the asset isn't rendered in the markup during SSR. The problem use case is when the marquee uses vue visual but there are a bunch of WYSWIYG rendered non-vue-visual assets in the page, the marquee assets load after since they are initialized after the simply embdeded HTML ones. Also, this would be better for SEO.

@weotch
Copy link
Member Author

weotch commented Jun 27, 2019

Actually, the correct way to do this is to clear the transitions for the asset you want to load immediately ... then it will be rendered immediately. So like:

vue-visual(
  :poster='$contentful.img(page.image, 274, 82)'
  :image='$contentful.img(page.image, 2740, 820)'
  :load-poster='true'
  transition-poster='')

Then the poster will be rendered in the original markup ... however, I'm thinking of handling a different way for this use case, using <link rel="preload"> with the marquee images I want to request before the WYSIWYG body ones.

@weotch
Copy link
Member Author

weotch commented Jun 27, 2019

Yeah, the link preload approach worked for me

@weotch weotch closed this as completed Jun 27, 2019
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