Skip to content

我看文档里 SSR 静态样式导出的介绍,只有全量导出的方案,像 antd of react 官网上的按需导出方案,在 Nuxt 中应该怎么写? #20

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

Closed
Logosww opened this issue Oct 30, 2023 · 5 comments
Labels
Feature help wanted Extra attention is needed

Comments

@Logosww
Copy link

Logosww commented Oct 30, 2023

求教

@Logosww
Copy link
Author

Logosww commented Oct 30, 2023

主要是我不知道要到哪个生命周期钩子里去预渲染一遍页面来获取 style cache 比较合适...想着既然是抽离样式按需导出的话,最好应该在 building 阶段完成,但 building 的时候又怎么去 renderToString 呢?

@aibayanyu20 aibayanyu20 added the help wanted Extra attention is needed label Nov 5, 2023
@aibayanyu20
Copy link
Member

目前没什么好方案,欢迎来PR

@markthree
Copy link
Contributor

markthree commented Jan 9, 2024

我简单实现了一个 demo,感兴趣可以看看,按需生成 → nuxt-antd-css-demo/tree/demand

如果可以,我想我可以提一个 pr 来迁移用到的组件,同时在 README 中加以说明。

核心用到的组件 → nuxt-antd-css-demo/blob/demand/components/AExtractStyle.vue

@aibayanyu20
Copy link
Member

aibayanyu20 commented Jan 10, 2024

我简单实现了一个 demo,感兴趣可以看看,按需生成 → nuxt-antd-css-demo/tree/demand

如果可以,我想我可以提一个 pr 来迁移用到的组件,同时在 README 中加以说明。

核心用到的组件 → nuxt-antd-css-demo/blob/demand/components/AExtractStyle.vue

@markthree 可以提交一个PR过来,nuxt3用到的都是esm模式,所以建议使用esm来测试,目前antdvnuxt插件也是仅输出es包,尽可能的保持一致性,支持可配置开启

@aibayanyu20
Copy link
Member

update 1.4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants