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

feat: extract style node to support Next.js _document.tsx render style tags #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Chastrlove
Copy link

Next.js ssr分离style时不允许直接使用extractStyle中提供的string类型的styles, 需要以react elements的形式定义。目前存在的都是hack写法:例如ant-design/ant-design#38767 (comment)

rel: ant-design/ant-design#39891ant-design/ant-design#39885

在Next.js中可以这么使用
image

@@ -483,3 +483,25 @@ export function extractStyle(cache: Cache) {

return styleText;
}

export function extractStyleNode(cache: Cache) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

逻辑是不是可以合并到 extractStyle 一起?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一开始我是想放一起的,直接让extraStyle 返回一个对象,让用户想获取那个就哪个,但是怕对用户来说有break change,所以重启炉灶

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 this pull request may close these issues.

2 participants