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

Can css be separated and not introduced into the suite together? #418

Closed
imagine10255 opened this issue Jul 25, 2022 · 8 comments
Closed

Comments

@imagine10255
Copy link

imagine10255 commented Jul 25, 2022

Can css be separated and not introduced into the suite together?

ex:

// modules css
import './index.css';
import 'bear-react-grid/dist/index.css';
import '@bearests/form/dist/index.css';
import 'bear-react-datepicker/dist/index.css';

better management style

@jaywcjlove
Copy link
Member

You can use plugins to strip out css imports. Like this : #52 (comment)

@imagine10255

@imagine10255
Copy link
Author

@jaywcjlove Hi, 我不是 nextjs, css 的部分是不是依照自己需要的方式去引入會比較好?

@jaywcjlove
Copy link
Member

@imagine10255 我的意思是的,如果你想自己引入css,可以使用 babel-plugin-transform-remove-imports 类似的插件移除 css 引入,然后你可以自己手动引入,或者自定义。

import "@uiw/react-md-editor/markdown-editor.css";
import "@uiw/react-markdown-preview/markdown.css";

@imagine10255
Copy link
Author

@jaywcjlove 感謝回覆, 知道了
另外我想請問, 為什麼不讓大家一開始就 自己手動引入, 而是需要先移除 後, 再手動引入,
大部分安裝到的套件的使用經驗都是這樣(沒手動引入就沒有CSS樣式)

@jaywcjlove
Copy link
Member

@imagine10255 我一开始使用的工具,就不需要 手动引入,如 create-react-app 和我自己搞的工具 kkt 也不需要,。公司内部项目全部都不需要手动引入 css。如果改了 所有项目都需要修改。这很麻烦。

@imagine10255
Copy link
Author

imagine10255 commented Jul 27, 2022

@jaywcjlove 了解。不過 create-react-app 是需要自己引入的吧?

https://codesandbox.io/s/trusting-jepsen-r52lgq?file=/src/App.js

CleanShot 2022-07-27 at 10 29 24@2x

@jaywcjlove
Copy link
Member

@imagine10255 https://codesandbox.io/s/uiwjs-react-md-editor-issues-418-vyrtdm?file=/src/App.js:72-92

看它不需要引入包中的样式,就可以加载样式

@imagine10255
Copy link
Author

@jaywcjlove 了解 感謝你

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

2 participants