Search code examples
emotion

Is it possible to generate css files using emotion?


emotion is a css-in-js library. I saw it created <style> tag in the html head to provide styles.

Is it possible to use emotion to generate separate css files? So that we can move them to CDN and make the app loading faster.


Solution

  • according to Docs, you can't do it. The way I used to generate an external stylesheet was to load my pages with SSR, and take the css generated by extractCritical, then write it to a file by using fs within style tag.