question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[react-jss] No critical css generated on server

See original GitHub issue

Expected behavior:

const sheets = new SheetsRegistry();
const html = ReactDOM.renderToString(
  <JssProvider registry={sheets}>
    <App />
  </JssProvider>
);
const css = sheets.toString();

css should not be empty.

Describe the bug: It seems that SheetsRegistry return empty string in toString method because no stylesheet is attached. Example repo: https://github.com/bungu/jss-no-critical-css

It works in v9

Versions (please complete the following information):

  • JSS: v10.0.0-alpha.13
  • React-JSS: v10.0.0-alpha.6
$ npm list jss react-jss
jss-no-critical-css@0.1.0 ~/sandbox/jss-no-critical-css
└─┬ react-jss@10.0.0-alpha.6
  └── UNMET PEER DEPENDENCY jss@10.0.0-alpha.13

npm ERR! peer dep missing: jss@10.0.0-alpha.3, required by jss-preset-default@10.0.0-alpha.7

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
kofcommented, Mar 17, 2019

Fixed, will be released in 10.0.0-alpha.14

0reactions
oliviertassinaricommented, Mar 17, 2019

Well done 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inlining critical CSS - Kevin Farrugia
This technique works both with CSS modules and not and can be easily added to an existing project. Performance-First React Template. While writing...
Read more >
Dynamically Inlining Critical CSS with Server-side JavaScript
The package we use to generate our critical CSS is PurifyCSS. It takes HTML and a stylesheet, then returns only the CSS which...
Read more >
My Experiences with Optimizing CSS for React Frontends
Like critical, it can be integrated during the build-time to generate HTML with optimized CSS. My experience with UnCSS: I found UnCSS to...
Read more >
Eliminate Render-blocking Resources using React and ...
After checking each file and the generated index.html after the build, I found three primary non-critical files -. a. 5.20aa2d7b.chunk.css - 98% ...
Read more >
Why is a statically generated page unstyled when sent to the ...
... similar to Next.js' website, you need to inline critical CSS. ... start ) not a dev one like you're doing in that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found