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

Get CSS styles working with styled-components #565

Closed
jvlobo opened this issue Jan 14, 2019 · 5 comments
Closed

Get CSS styles working with styled-components #565

jvlobo opened this issue Jan 14, 2019 · 5 comments

Comments

@jvlobo
Copy link

jvlobo commented Jan 14, 2019

Hi guys!

I'm running prerender on my server, SSR works very well apart from the styles. I use styled-components in my project and they have this documentation about using SSR.

I've been struggling to implement the solution... but I'm not able to get it working.

Does anybody had got SSR working with prerender and styled-components?

Any help in this matter will be highly appreciated.

Cheers.

@thoop
Copy link
Contributor

thoop commented Jan 14, 2019

Since we remove the js from the page, the only option you currently have there is to export your CSS onto the page so that the static HTML page can use that CSS. Does styled-components have a CSS export ability so that you can inject that onto the page?

@jvlobo
Copy link
Author

jvlobo commented Jan 14, 2019

Thank you for your answer @thoop

So, as far as I know, and after searching a bit about it, it seems styled-components doesn't have that possibility: styled-components/styled-components#1018

:(

@jvlobo
Copy link
Author

jvlobo commented Jan 15, 2019

I opened a thread asking for help in the styled-components forum -> Get CSS styles working with prerender.io

Apparently, there is no solution for this... that's a pity 😔

@thoop
Copy link
Contributor

thoop commented Jan 16, 2019

That's unfortunate :(

Prerender.io removes the javascript from the page because we don't want the crawlers to try to execute any javascript and accidentally clear out the prerendered content. So the page needs to render properly without javascript being run, hence the need for the exported CSS to be in the HTML.

I'm going to close this issue since it would require us leaving all javascript on the page and that's not something we plan on doing currently. If you find a way to export that CSS, please let us know how you do it!

@jessepinho
Copy link

@jvlobo I've opened a similar issue over at #574

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

3 participants